Skip to content

Commit

Permalink
refactor: stuff (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Mar 6, 2019
1 parent e9ce745 commit cc81af1
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 36 deletions.
8 changes: 0 additions & 8 deletions src/index.js
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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 () => {
Expand Down
2 changes: 1 addition & 1 deletion test/errors.test.js
@@ -1,4 +1,4 @@
const loader = require('../src/cjs');
import loader from '../src/cjs';

it('validation', () => {
const validate = (options) =>
Expand Down
2 changes: 1 addition & 1 deletion test/getLocalIdent-option.test.js
@@ -1,4 +1,4 @@
const path = require('path');
import path from 'path';

const { webpack, evaluated } = require('./helpers');

Expand Down
14 changes: 7 additions & 7 deletions 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;
Expand Down
6 changes: 3 additions & 3 deletions 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);
Expand Down
2 changes: 1 addition & 1 deletion 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 () => {
Expand Down
4 changes: 2 additions & 2 deletions 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 () => {
Expand Down
6 changes: 3 additions & 3 deletions 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 () => {
Expand Down
4 changes: 2 additions & 2 deletions 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 () => {
Expand Down
6 changes: 3 additions & 3 deletions 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);
Expand Down
6 changes: 3 additions & 3 deletions 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', () => {
Expand Down
2 changes: 1 addition & 1 deletion 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 () => {
Expand Down

0 comments on commit cc81af1

Please sign in to comment.