Skip to content

Commit

Permalink
test($core): use es6 import
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun554 committed Aug 26, 2018
1 parent bf460e8 commit 2e95b52
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

9 changes: 9 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
'env': {
'test': {
'presets': [
['@babel/preset-env', { 'targets': { 'node': 8 }}]
]
}
}
}
5 changes: 1 addition & 4 deletions packages/@vuepress/core/__test__/plugin-api/Option.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// TODO change to ES6 import
// https://github.com/facebook/jest/issues/6835

const Option = require('../../lib/plugin-api/Option')
import Option from '../../lib/plugin-api/Option'

describe('Option', () => {
test('shoould option record the key', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/@vuepress/core/__test__/plugin-api/PluginAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ jest.mock('vuepress-plugin-a')
jest.mock('vuepress-plugin-b')
jest.mock('@org/vuepress-plugin-a')

const PluginAPI = require('../../lib/plugin-api/index')
const { PLUGIN_OPTION_MAP } = require('../../lib/plugin-api/constants')
import PluginAPI from '../../lib/plugin-api/index'
import { PLUGIN_OPTION_MAP } from '../../lib/plugin-api/constants'

describe('Plugin', () => {
test('should \'registerOption\' work.', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
jest.mock('vuepress-plugin-a')
jest.mock('@org/vuepress-plugin-a')

const {
import {
resolvePlugin,
hydratePlugin,
resolveScopePackage
} = require('../../lib/plugin-api/util')
} from '../../lib/plugin-api/util'

function resolveMockModule (name) {
return require(`../../../../../__mocks__/${name}`)
}

// const Plugin = require('../../lib/plugin-api/index')

describe('resolvePlugin', () => {
test('should resolve scope packages correctly.', () => {
const pkg1 = resolveScopePackage('@vuepress/plugin-a')
Expand Down

0 comments on commit 2e95b52

Please sign in to comment.