From cc81af108c4f26e7cd30cc92895ee16ecd6ed8f1 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Wed, 6 Mar 2019 18:22:49 +0300 Subject: [PATCH] refactor: stuff (#903) --- src/index.js | 8 -------- test/camelCase-option.test.js | 2 +- test/errors.test.js | 2 +- test/getLocalIdent-option.test.js | 2 +- test/helpers.js | 14 +++++++------- test/icss.test.js | 6 +++--- test/import-option.test.js | 2 +- test/importLoaders-option.test.js | 4 ++-- test/loader.test.js | 6 +++--- test/localIdentName-option.test.js | 4 ++-- test/modules-option.test.js | 6 +++--- test/sourceMap-option.test.js | 6 +++--- test/url-option.test.js | 2 +- 13 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/index.js b/src/index.js index c499ce2a..c5ab3f94 100644 --- a/src/index.js +++ b/src/index.js @@ -151,14 +151,6 @@ export default function loader(content, map, meta) { .warnings() .forEach((warning) => this.emitWarning(new Warning(warning))); - if (result.map) { - const newMap = result.map.toJSON(); - - console.log(newMap.file); - console.log(newMap.sourceRoot); - console.log(newMap.sources); - } - const messages = result.messages || []; // Run other loader (`postcss-loader`, `sass-loader` and etc) for importing CSS diff --git a/test/camelCase-option.test.js b/test/camelCase-option.test.js index 4e6c19dd..909a45d3 100644 --- a/test/camelCase-option.test.js +++ b/test/camelCase-option.test.js @@ -1,4 +1,4 @@ -const { webpack, evaluated } = require('./helpers'); +import { webpack, evaluated } from './helpers'; describe('camelCase option', () => { it('true', async () => { diff --git a/test/errors.test.js b/test/errors.test.js index 6c3d3970..10ff73e4 100644 --- a/test/errors.test.js +++ b/test/errors.test.js @@ -1,4 +1,4 @@ -const loader = require('../src/cjs'); +import loader from '../src/cjs'; it('validation', () => { const validate = (options) => diff --git a/test/getLocalIdent-option.test.js b/test/getLocalIdent-option.test.js index 1c560171..9436da16 100644 --- a/test/getLocalIdent-option.test.js +++ b/test/getLocalIdent-option.test.js @@ -1,4 +1,4 @@ -const path = require('path'); +import path from 'path'; const { webpack, evaluated } = require('./helpers'); diff --git a/test/helpers.js b/test/helpers.js index c0bece72..67a9d442 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -1,11 +1,11 @@ -const vm = require('vm'); -const path = require('path'); +import vm from 'vm'; +import path from 'path'; -const del = require('del'); -const webpack = require('webpack'); -const MemoryFS = require('memory-fs'); -const stripAnsi = require('strip-ansi'); -const normalizePath = require('normalize-path'); +import del from 'del'; +import webpack from 'webpack'; +import MemoryFS from 'memory-fs'; +import stripAnsi from 'strip-ansi'; +import normalizePath from 'normalize-path'; function evaluated(output, modules, moduleId = 1) { let m; diff --git a/test/icss.test.js b/test/icss.test.js index 01599bad..d83875aa 100644 --- a/test/icss.test.js +++ b/test/icss.test.js @@ -1,7 +1,7 @@ -const path = require('path'); -const fs = require('fs'); +import path from 'path'; +import fs from 'fs'; -const { webpack, evaluated } = require('./helpers'); +import { webpack, evaluated } from './helpers'; const testCasesPath = path.join(__dirname, 'fixtures/icss/tests-cases'); const testCases = fs.readdirSync(testCasesPath); diff --git a/test/import-option.test.js b/test/import-option.test.js index d4b946ba..fc6f92d1 100644 --- a/test/import-option.test.js +++ b/test/import-option.test.js @@ -1,4 +1,4 @@ -const { webpack, evaluated, normalizeErrors } = require('./helpers'); +import { webpack, evaluated, normalizeErrors } from './helpers'; describe('import option', () => { it('true', async () => { diff --git a/test/importLoaders-option.test.js b/test/importLoaders-option.test.js index 7cc02ad0..25952b9c 100644 --- a/test/importLoaders-option.test.js +++ b/test/importLoaders-option.test.js @@ -1,6 +1,6 @@ -const postcssPresetEnv = require('postcss-preset-env'); +import postcssPresetEnv from 'postcss-preset-env'; -const { webpack, evaluated } = require('./helpers'); +import { webpack, evaluated } from './helpers'; describe('importLoaders option', () => { it('not specify (no loader before)', async () => { diff --git a/test/loader.test.js b/test/loader.test.js index 970336e9..4fea2209 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -1,8 +1,8 @@ -const path = require('path'); +import path from 'path'; -const postcssPresetEnv = require('postcss-preset-env'); +import postcssPresetEnv from 'postcss-preset-env'; -const { webpack, evaluated, normalizeErrors } = require('./helpers'); +import { webpack, evaluated, normalizeErrors } from './helpers'; describe('loader', () => { it('should compile with `js` entry point', async () => { diff --git a/test/localIdentName-option.test.js b/test/localIdentName-option.test.js index c830ce60..91aac177 100644 --- a/test/localIdentName-option.test.js +++ b/test/localIdentName-option.test.js @@ -1,6 +1,6 @@ -const path = require('path'); +import path from 'path'; -const { webpack, evaluated } = require('./helpers'); +import { webpack, evaluated } from './helpers'; describe('localIdentName option', () => { it('basic', async () => { diff --git a/test/modules-option.test.js b/test/modules-option.test.js index 3b83ff4e..84dae6ec 100644 --- a/test/modules-option.test.js +++ b/test/modules-option.test.js @@ -1,7 +1,7 @@ -const path = require('path'); -const fs = require('fs'); +import path from 'path'; +import fs from 'fs'; -const { webpack, evaluated } = require('./helpers'); +import { webpack, evaluated } from './helpers'; const testCasesPath = path.join(__dirname, 'fixtures/modules/tests-cases'); const testCases = fs.readdirSync(testCasesPath); diff --git a/test/sourceMap-option.test.js b/test/sourceMap-option.test.js index 04ba498f..92de774a 100644 --- a/test/sourceMap-option.test.js +++ b/test/sourceMap-option.test.js @@ -1,8 +1,8 @@ -const path = require('path'); +import path from 'path'; -const postcssPresetEnv = require('postcss-preset-env'); +import postcssPresetEnv from 'postcss-preset-env'; -const { webpack, evaluated, normalizeSourceMap } = require('./helpers'); +import { webpack, evaluated, normalizeSourceMap } from './helpers'; describe('sourceMap option', () => { describe('true', () => { diff --git a/test/url-option.test.js b/test/url-option.test.js index 6893d35a..42c1a938 100644 --- a/test/url-option.test.js +++ b/test/url-option.test.js @@ -1,4 +1,4 @@ -const { webpack, evaluated, normalizeErrors } = require('./helpers'); +import { webpack, evaluated, normalizeErrors } from './helpers'; describe('url option', () => { it('true', async () => {