Skip to content

Commit

Permalink
fix: avoid different content on different os
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 16, 2020
1 parent fe3b33b commit f9a2409
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Setup Git
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf input

- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
Expand Down
54 changes: 54 additions & 0 deletions test/__snapshots__/prependData-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`prependData option should use same EOL on all os (dart-sass) (sass): css 1`] = `
"a {
color: hotpink;
}
body {
color: hotpink;
}"
`;

exports[`prependData option should use same EOL on all os (dart-sass) (sass): errors 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (dart-sass) (sass): warnings 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (dart-sass) (scss): css 1`] = `
"a {
color: red;
}
body {
color: hotpink;
}"
`;

exports[`prependData option should use same EOL on all os (dart-sass) (scss): errors 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (dart-sass) (scss): warnings 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (node-sass) (sass): css 1`] = `
"a {
color: hotpink; }
body {
color: hotpink; }
"
`;

exports[`prependData option should use same EOL on all os (node-sass) (sass): errors 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (node-sass) (sass): warnings 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (node-sass) (scss): css 1`] = `
"a {
color: red; }
body {
color: hotpink; }
"
`;

exports[`prependData option should use same EOL on all os (node-sass) (scss): errors 1`] = `Array []`;

exports[`prependData option should use same EOL on all os (node-sass) (scss): warnings 1`] = `Array []`;

exports[`prependData option should work with the "data" option as a function (dart-sass) (sass): css 1`] = `
"body {
color: hotpink;
Expand Down
24 changes: 24 additions & 0 deletions test/prependData-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@ describe('prependData option', () => {
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it(`should use same EOL on all os (${implementationName}) (${syntax})`, async () => {
const testId = getTestId('prepending-data', syntax);
const prependData =
syntax === 'sass'
? `$prepended-data: hotpink
a
color: $prepended-data`
: `$prepended-data: hotpink;
a {
color: red;
}`;
const options = {
implementation: getImplementationByName(implementationName),
prependData,
};
const compiler = getCompiler(testId, { loader: { options } });
const stats = await compile(compiler);
const codeFromBundle = getCodeFromBundle(stats, compiler);

expect(codeFromBundle.css).toMatchSnapshot('css');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');
});
});
});
});

0 comments on commit f9a2409

Please sign in to comment.