Skip to content

Commit

Permalink
test: fix fiber test (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Aug 23, 2019
1 parent fab50ab commit ac14fd5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
24 changes: 12 additions & 12 deletions test/__snapshots__/sassOptions-option.test.js.snap
Expand Up @@ -752,7 +752,7 @@ exports[`sassOptions option should work when the option like "Object" (node-sass

exports[`sassOptions option should work when the option like "Object" (node-sass) (scss): warnings 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (sass): css 1`] = `
exports[`sassOptions option should work with the "fiber" option (dart-sass) (sass): css 1`] = `
"@charset \\"UTF-8\\";
body {
font: 100% Helvetica, sans-serif;
Expand Down Expand Up @@ -807,11 +807,11 @@ nav a {
}"
`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (sass): errors 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (dart-sass) (sass): errors 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (sass): warnings 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (dart-sass) (sass): warnings 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (scss): css 1`] = `
exports[`sassOptions option should work with the "fiber" option (dart-sass) (scss): css 1`] = `
"@charset \\"UTF-8\\";
body {
font: 100% Helvetica, sans-serif;
Expand Down Expand Up @@ -848,11 +848,11 @@ nav a {
}"
`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (scss): errors 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (dart-sass) (scss): errors 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (dart-sass) (scss): warnings 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (dart-sass) (scss): warnings 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (sass): css 1`] = `
exports[`sassOptions option should work with the "fiber" option (node-sass) (sass): css 1`] = `
"@charset \\"UTF-8\\";
body {
font: 100% Helvetica, sans-serif;
Expand Down Expand Up @@ -899,11 +899,11 @@ nav a {
"
`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (sass): errors 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (node-sass) (sass): errors 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (sass): warnings 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (node-sass) (sass): warnings 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (scss): css 1`] = `
exports[`sassOptions option should work with the "fiber" option (node-sass) (scss): css 1`] = `
"@charset \\"UTF-8\\";
body {
font: 100% Helvetica, sans-serif;
Expand Down Expand Up @@ -936,9 +936,9 @@ nav a {
"
`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (scss): errors 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (node-sass) (scss): errors 1`] = `Array []`;

exports[`sassOptions option should work with the "fibers" option (node-sass) (scss): warnings 1`] = `Array []`;
exports[`sassOptions option should work with the "fiber" option (node-sass) (scss): warnings 1`] = `Array []`;

exports[`sassOptions option should work with the "functions" option (dart-sass) (sass): css 1`] = `
"h2, h3, h4, h5 {
Expand Down
10 changes: 8 additions & 2 deletions test/sassOptions-option.test.js
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import semver from 'semver';
import nodeSass from 'node-sass';
import dartSass from 'sass';
import Fiber from 'fibers';

import {
compile,
Expand All @@ -18,6 +19,11 @@ const implementations = [nodeSass, dartSass];
const syntaxStyles = ['scss', 'sass'];

describe('sassOptions option', () => {
beforeEach(() => {
// The `sass` (`Dart Sass`) package modify the `Function` prototype, but the `jest` lose a prototype
Object.setPrototypeOf(Fiber, Function.prototype);
});

implementations.forEach((implementation) => {
const [implementationName] = implementation.info.split('\t');

Expand Down Expand Up @@ -154,7 +160,7 @@ describe('sassOptions option', () => {
expect(stats.compilation.errors).toMatchSnapshot('errors');
});

it(`should work with the "fibers" option (${implementationName}) (${syntax})`, async () => {
it(`should work with the "fiber" option (${implementationName}) (${syntax})`, async () => {
const testId = getTestId('language', syntax);
const options = {
implementation: getImplementationByName(implementationName),
Expand All @@ -163,7 +169,7 @@ describe('sassOptions option', () => {

if (semver.satisfies(process.version, '>= 10')) {
// eslint-disable-next-line global-require
options.sassOptions.fibers = require('fibers');
options.sassOptions.fiber = Fiber;
}

const stats = await compile(testId, { loader: { options } });
Expand Down

0 comments on commit ac14fd5

Please sign in to comment.