Skip to content

Commit

Permalink
fixed misleading test
Browse files Browse the repository at this point in the history
this was forgotten in 8d4db7e

note that this reveals an inconsistency within faucet-core WRT how
module paths are handled between Node versions: legacy mode (Node v6)
does not fall back to relative paths while non-legacy mode (Node v8)
does attempt to use relative paths if no corresponding package path
exists
  • Loading branch information
FND committed Feb 10, 2018
1 parent f402168 commit dd518ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"babel-core": "^6.26",
"faucet-pipeline": "1.0.0-beta.0",
"mkdirp": "^0.5.1",
"rollup": "^0.55.4",
"rollup": "^0.55.5",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-node-resolve": "^3.0.2"
},
Expand Down
10 changes: 6 additions & 4 deletions test/unit/test_bundling.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,19 @@ console.log("[\\u2026] " + util); // eslint-disable-line no-console
});
});

it("should balk at non-relative paths in config", () => {
it("should balk at non-relative paths for target", () => {
let assetManager = new MockAssetManager(FIXTURES_DIR);
let entryPoint = "src/index.js";
let target = "dist/bundle.js";
let compile = (source, target) => faucetJS([{ source, target }], assetManager);

let fn = _ => compile(entryPoint, target);
let fn = _ => compile(`./${entryPoint}`, target);
assert.throws(fn, /path must be relative/);

fn = _ => compile(`./${entryPoint}`, target);
assert.throws(fn, /path must be relative/);
// non-relative path is acceptable for entry point, but a suitable
// package path does not exist
fn = _ => compile(entryPoint, `./${target}`);
assert.throws(fn, /could not resolve/);

return compile(`./${entryPoint}`, `./${target}`);
});
Expand Down

0 comments on commit dd518ba

Please sign in to comment.