-
-
Notifications
You must be signed in to change notification settings - Fork 3
Resolve copy paths relative to src in DomStack constructor #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
4dd014e
c0ca6d6
8eb2c0a
d89abf5
fce6532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { test } from 'node:test' | ||
| import assert from 'node:assert' | ||
| import { isAbsolute } from 'node:path' | ||
| import { DomStack } from '../../index.js' | ||
|
|
||
| test.describe('DomStack constructor - copy path resolution', () => { | ||
| test('resolves a relative copy path to an absolute path', () => { | ||
| const ds = new DomStack('/tmp/test-src', '/tmp/test-dest', { | ||
| copy: ['some-relative-copy-dir'], | ||
| }) | ||
|
|
||
| assert.strictEqual(ds.opts.copy.length, 1, 'one copy entry') | ||
| assert.ok(isAbsolute(ds.opts.copy[0]), `copy path should be absolute, got: "${ds.opts.copy[0]}"`) | ||
|
Check failure on line 13 in test-cases/constructor-copy-paths/index.test.js
|
||
| }) | ||
|
|
||
| test('leaves an already-absolute copy path unchanged', () => { | ||
| const ds = new DomStack('/tmp/test-src', '/tmp/test-dest', { | ||
| copy: ['/absolute/copy/dir'], | ||
| }) | ||
|
|
||
| assert.strictEqual(ds.opts.copy[0], '/absolute/copy/dir', 'absolute path is preserved') | ||
| }) | ||
|
bcomnes marked this conversation as resolved.
Outdated
|
||
|
|
||
| test('resolves multiple mixed copy paths', () => { | ||
| const ds = new DomStack('/tmp/test-src', '/tmp/test-dest', { | ||
| copy: ['relative-dir', '/absolute/dir'], | ||
| }) | ||
|
|
||
| assert.strictEqual(ds.opts.copy.length, 2, 'two copy entries') | ||
| for (const p of ds.opts.copy) { | ||
| assert.ok(isAbsolute(p), `each copy path should be absolute, got: "${p}"`) | ||
| } | ||
| }) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.