Skip to content

Commit

Permalink
Vue 3 tests, dep updates, bump
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt authored Mar 30, 2022
1 parent 270ad0b commit 051ede1
Show file tree
Hide file tree
Showing 21 changed files with 32,530 additions and 10,880 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chrome 91
chrome 99
39 changes: 31 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const path = require('path');

const baseRestrictedSyntax = require('eslint-config-tjw-base/no-restricted-syntax.json');
const jestRestrictedSyntax = require('eslint-config-tjw-jest/no-restricted-syntax.json');

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 8,
parser: '@babel/eslint-parser',
ecmaVersion: 2022,
sourceType: 'module'
},
env: {
Expand All @@ -28,22 +33,40 @@ module.exports = {
'plugin:jest/recommended',
'plugin:vuejs-accessibility/recommended',
'tjw-base',
'tjw-vue'
'tjw-vue',
'tjw-import',
'tjw-jest'
],
rules: {
'import/no-extraneous-dependencies': 'off',
'no-restricted-syntax': [
'error',
'Property[method="true"]'
...baseRestrictedSyntax,
...jestRestrictedSyntax
],
'vuejs-accessibility/label-has-for': [
'error',
{
'components': ['Label'],
'required': {
'some': ['nesting', 'id']
components: ['Label'],
required: {
some: ['nesting', 'id']
},
'allowChildren': false
allowChildren: false
}
]
},
settings: {
'import/resolver': {
webpack: {
config: {
resolve: {
alias: {
'@': path.resolve('src'),
'@@': path.resolve('tests')
}
}
}
}
}
}
};
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

[![Build Status](https://travis-ci.org/nwutils/nw-vue-cli-example.svg?branch=master)](https://travis-ci.org/nwutils/nw-vue-cli-example)

* 1.x releases use: Vue 2 + NW.js latest + Vue-CLI 4
* 2.x releases use: Vue 3 + NW.js latest + Vue-CLI 4
* 1.x releases use: Vue 2 + NW.js latest + Vue-CLI 5
* 2.x releases use: Vue 3 + NW.js latest + Vue-CLI 5

![A screenshot of the default app running on Windows](screenshot.png)

**Comes with:**

* NW.js 0.54.0
* Chrome 91
* Node 16.1.0
* Vue-CLI 4.5.13
* Vue 2.6.14
* Vue-DevTools-Beta (latest)
* NW.js 0.62.2
* Chrome 99
* Node 17.7.2
* Vue-CLI 5.0.4
* Vue 3.2.31
* Vue-DevTools (latest)
* Babel
* ESLint
* Vue Linting
* A11Y Linting
* Jest Linting
* Import Linting


## Why is this in Alpha? When will this be ready?

Expand All @@ -29,7 +31,6 @@ It is recommended to use the 1.x version of this boilerplate until Vue 3 compati
* Vue Test-Utils 2 - Soon to be released
* Jest-Serializer-Vue-TJW (snapshot testing) - Waiting on VTU2


*Does this work for web or just desktop?*

**Both**. This repo will build both for web and desktop and includes a simple `this.isDesktop` flag so you can add Desktop specific features that won't show on the web. This repo has 100% test coverage including tests for both web and desktop builds. You could even theoretically add NativeScript-Vue into the mix and build for native mobile as well (though that is not set up in this repo).
Expand All @@ -41,6 +42,7 @@ Those are both very easily added from the Vue-CLI. There is also no custom styli

If you want to load the app with a splash screen, check the `nw-splasher` branch.


## Documentation

In all .vue components, you have access to `nw`, `global`, `process`, `require`, and the boolean `isDesktop`:
Expand Down
8 changes: 7 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
['@babel/preset-env',
{
targets: {
node: 'current'
}
}
]
]
};
26 changes: 20 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@ process.env.VUE_CLI_BABEL_TARGET_NODE = true;
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true;

module.exports = {
preset: '@vue/cli-plugin-unit-jest',
// preset: '@vue/cli-plugin-unit-jest',
coverageDirectory: '<rootDir>/tests/unit/coverage',
moduleFileExtensions: [
'vue',
'js',
'json',
'node'
],
moduleNameMapper: {
'^@@/(.*)$': '<rootDir>/tests/$1',
'^@/(.*)$': '<rootDir>/src/$1'
},
setupFilesAfterEnv: [
'<rootDir>/tests/unit/setup.js'
],
snapshotSerializers: [
'<rootDir>/node_modules/jest-serializer-vue-tjw'
'<rootDir>/tests/unit/serializer.js'
],
testMatch: [
'**/tests/unit/**/*.test.js'
],
testPathIgnorePatterns: [
'<rootDir>/tests/e2e',
'<rootDir>/dist',
'<rootDir>/dist-vue'
]
'<rootDir>/tests/e2e/*',
'<rootDir>/dist/*',
'<rootDir>/dist-vue/*'
],
transform: {
'^.+\\.vue$': 'vue-jest',
'^.+\\js$': 'babel-jest'
}
};
Loading

0 comments on commit 051ede1

Please sign in to comment.