|
1 | | -import path from 'path'; |
2 | | -import {readFile, copy, outputFile, remove} from 'fs-extra'; |
3 | | -import test from 'ava'; |
4 | | -import {spy, match} from 'sinon'; |
5 | | -import tempy from 'tempy'; |
6 | | -import cssnano from 'cssnano'; |
7 | | -import mixins from 'postcss-mixins'; |
8 | | -import simpleVars from 'postcss-simple-vars'; |
9 | | -import atImport from 'postcss-import'; |
10 | | -import {waitFor, compile} from './helpers/utils'; |
11 | | -import {mockPreprocessor} from './helpers/mock'; |
| 1 | +const path = require('path'); |
| 2 | +const {readFile, copy, outputFile, remove} = require('fs-extra'); |
| 3 | +const test = require('ava'); |
| 4 | +const {spy, match} = require('sinon'); |
| 5 | +const tempy = require('tempy'); |
| 6 | +const cssnano = require('cssnano'); |
| 7 | +const mixins = require('postcss-mixins'); |
| 8 | +const simpleVars = require('postcss-simple-vars'); |
| 9 | +const atImport = require('postcss-import'); |
| 10 | +const {waitFor, compile} = require('./helpers/utils'); |
| 11 | +const {mockPreprocessor} = require('./helpers/mock'); |
12 | 12 |
|
13 | 13 | test('Compile css file', async t => { |
14 | 14 | const fixture = 'test/fixtures/basic.css'; |
@@ -155,7 +155,7 @@ test('Log error on invalid css file', async t => { |
155 | 155 | const options = {plugins: [atImport, mixins, simpleVars, cssnano]}; |
156 | 156 | const {preprocessor, debug, error} = await mockPreprocessor({}, {postcssPreprocessor: {options}}); |
157 | 157 | const file = {originalPath: fixture}; |
158 | | - const err = await t.throwsAsync(preprocessor(await readFile(fixture), file), {instanceOf: Object}); |
| 158 | + const err = await t.throwsAsync(preprocessor(await readFile(fixture), file), {instanceOf: Error}); |
159 | 159 |
|
160 | 160 | t.is(err.name, 'CssSyntaxError'); |
161 | 161 | t.true(debug.firstCall.calledWith(match('Processing'), fixture)); |
@@ -467,7 +467,7 @@ test('Call refreshFiles when dependency is deleted and added', async t => { |
467 | 467 | t.true(refreshFiles.calledOnce); |
468 | 468 | info.resetHistory(); |
469 | 469 | refreshFiles.resetHistory(); |
470 | | - await t.throwsAsync(preprocessor(await readFile(fixture), file), Error); |
| 470 | + await t.throwsAsync(preprocessor(await readFile(fixture), file), {instanceOf: Error}); |
471 | 471 | const cpy = waitFor(watcher, 'add'); |
472 | 472 |
|
473 | 473 | await copy('test/fixtures/partials/partial.css', partial); |
|
0 commit comments