Skip to content

Commit

Permalink
test: fix (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Sep 28, 2020
1 parent 409877c commit 678eac8
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/utils.js
Expand Up @@ -348,7 +348,9 @@ async function createEvaluator(loaderContext, code, options) {
let webpackResolveError;

if (node.name !== 'url' && nodePath && !URL_RE.test(nodePath)) {
const dependencies = resolvedDependencies.get(node.filename);
const dependencies = resolvedDependencies.get(
path.normalize(node.filename)
);

if (dependencies) {
const dependency = dependencies.find((item) => {
Expand Down
78 changes: 78 additions & 0 deletions test/__snapshots__/loader.test.js.snap
Expand Up @@ -139,6 +139,73 @@ exports[`loader imports files listed in glob with deps: errors 1`] = `Array []`;

exports[`loader imports files listed in glob with deps: warnings 1`] = `Array []`;

exports[`loader imports files listed in glob with webpack import 2: css 1`] = `
".a-glob {
color: #000;
}
.b-glob {
background: #808080;
}
.a-glob-webpack {
color: #000;
}
.b-glob-webpack {
background: #808080;
}
.a-glob {
color: #000;
}
.b-glob {
background: #808080;
}
.a-glob-webpack {
color: #000;
}
.b-glob-webpack {
background: #808080;
}
.glob-entry {
box-sizing: border-box;
}
"
`;

exports[`loader imports files listed in glob with webpack import 2: errors 1`] = `Array []`;

exports[`loader imports files listed in glob with webpack import 2: warnings 1`] = `Array []`;

exports[`loader imports files listed in glob with webpack import with deps: css 1`] = `
".a-glob {
color: #000;
}
.b-glob {
background: #808080;
}
.a-glob-webpack {
color: #000;
}
.b-glob-webpack {
background: #808080;
}
.glob-in-node {
color: #fff;
}
.glob-in-node {
background: #ff7f50;
}
.index-glob {
font-size: 1rem;
}
.glob-entry {
box-sizing: border-box;
}
"
`;

exports[`loader imports files listed in glob with webpack import with deps: errors 1`] = `Array []`;

exports[`loader imports files listed in glob with webpack import with deps: warnings 1`] = `Array []`;

exports[`loader imports files listed in nested glob import: css 1`] = `
".a-nested-glob {
color: #f00;
Expand Down Expand Up @@ -329,6 +396,17 @@ exports[`loader in a nested import load module from paths: errors 1`] = `Array [

exports[`loader in a nested import load module from paths: warnings 1`] = `Array []`;

exports[`loader in a nested import load module from webpack: css 1`] = `
".imported-in-web-modules {
font-size: 2em;
}
"
`;

exports[`loader in a nested import load module from webpack: errors 1`] = `Array []`;

exports[`loader in a nested import load module from webpack: warnings 1`] = `Array []`;

exports[`loader resolve with webpack if stylus can't find it: css 1`] = `
".imported-in-web-modules {
font-size: 2em;
Expand Down
6 changes: 3 additions & 3 deletions test/loader.test.js
Expand Up @@ -410,7 +410,7 @@ describe('loader', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it.skip('in a nested import load module from webpack', async () => {
it('in a nested import load module from webpack', async () => {
const testId = './shallow-webpack.styl';
const compiler = getCompiler(
testId,
Expand Down Expand Up @@ -858,7 +858,7 @@ describe('loader', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it.skip('imports files listed in glob with webpack import with deps', async () => {
it('imports files listed in glob with webpack import with deps', async () => {
const testId = './import-glob-webpack.styl';
const compiler = getCompiler(
testId,
Expand Down Expand Up @@ -940,7 +940,7 @@ describe('loader', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it.skip('imports files listed in glob with webpack import 2', async () => {
it('imports files listed in glob with webpack import 2', async () => {
const testId = './import-glob-webpack-2.styl';
const compiler = getCompiler(
testId,
Expand Down

0 comments on commit 678eac8

Please sign in to comment.