Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
💚 test: Feature/lint circleci (#14) by @d0whc3r
Browse files Browse the repository at this point in the history
* Normalize scoped names in build

* Change stripNamespaceIfExists function

Include check for empty name in stripNamespaceIfExists function

* use "isDef" in stripNamespaceIfExists function

* Update code style

* add semicolons in lint

* add lint:ci in circleci

* fix semicolons
  • Loading branch information
d0whc3r authored and kazupon committed Feb 20, 2019
1 parent 6439350 commit cac17ca
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
docker:
# specify the version you desire here
- image: circleci/node:10.15.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
Expand All @@ -32,6 +32,7 @@ jobs:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!

# run lint and tests!
- run: yarn lint:ci
- run: yarn test
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = {
env: {
},
rules: {
semi: ['error', 'never']
}
}
2 changes: 1 addition & 1 deletion generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (api, options, rootOptions) => {
debug('options', options)
debug('rootOptions', rootOptions)
let { projectName } = rootOptions
projectName = stripNamespaceIfExists(projectName);
projectName = stripNamespaceIfExists(projectName)
// basic extending
api.extendPackage({
scripts: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"changelog": "conventional-changelog -i CHANGELOG.md -s -n ./node_modules/git-commit-message-convention/convention.js",
"clean": "rimraf coverage tests/e2e/projects/*",
"lint": "eslint --fix --ext .js .",
"lint:ci": "eslint --ext .js .",
"release": "conventional-github-releaser -n ./node_modules/git-commit-message-convention/convention.js",
"test": "npm run test:unit",
"test:unit": "jest ./tests/unit/**/*.spec.js",
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/generators/core.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('javascript', async () => {
apply: require('../../../generator'),
options: {}
}])
checkPackageExpectations(pkg, projectName);
checkPackageExpectations(pkg, projectName)
// check files
const plugin = files['src/index.js']
expect(plugin).toMatch(`Vue.prototype.$add = (a, b) => {`)
Expand Down Expand Up @@ -60,8 +60,8 @@ test('typescript', async () => {
})

test('javascript with namespace', async () => {
const projectName = '@testing/vue-i18n-gen-js';
const projectNameNoNamespace = 'vue-i18n-gen-js';
const projectName = '@testing/vue-i18n-gen-js'
const projectNameNoNamespace = 'vue-i18n-gen-js'

const { pkg, files } = await generateWithPlugin([{
id: '@vue/cli-service',
Expand All @@ -72,15 +72,15 @@ test('javascript with namespace', async () => {
apply: require('../../../generator'),
options: {}
}])
checkPackageExpectations(pkg, projectNameNoNamespace);
checkPackageExpectations(pkg, projectNameNoNamespace)
// check files
const plugin = files['src/index.js']
expect(plugin).toMatch(`Vue.prototype.$add = (a, b) => {`)
})

function checkPackageExpectations (pkg, name) {
// check pkg
console.log('checking package');
console.log('checking package')
expect(pkg.sideeffects).toBe(false)
expect(pkg.main).toBe(`dist/${name}.common.js`)
expect(pkg.jsdelivr).toBe(`dist/${name}.umd.min.js`)
Expand All @@ -92,7 +92,7 @@ function checkPackageExpectations (pkg, name) {
`dist/${name}.umd.js`,
`dist/${name}.esm.js`,
'src'
];
]

distFiles.forEach(file => { expect(pkg.files).toContain(file) })
}

0 comments on commit cac17ca

Please sign in to comment.