-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update to be comply with module-template
- Loading branch information
Nicolas Pennec
committed
Apr 14, 2018
1 parent
95928aa
commit cc8af0a
Showing
9 changed files
with
2,878 additions
and
2,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
module.exports = require('nuxt-module-builder/eslint') | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
jest: true | ||
}, | ||
extends: 'standard', | ||
plugins: [ | ||
'jest', | ||
'vue' | ||
], | ||
rules: { | ||
// Allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// Allow async-await | ||
'generator-star-spacing': 0, | ||
// Allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
// Do not allow console.logs etc... | ||
'no-console': 2 | ||
}, | ||
globals: { | ||
'jest/globals': true, | ||
jasmine: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ node_modules | |
.vscode | ||
.DS_STORE | ||
coverage | ||
dist | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
const { resolve } = require('path') | ||
|
||
module.exports = { | ||
rootDir: resolve(__dirname, '../..'), | ||
srcDir: __dirname, | ||
dev: false, | ||
render: { | ||
resourceHints: false | ||
}, | ||
modules: [ | ||
['~/../..', {}] | ||
] | ||
modules: ['@@'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
export default { | ||
} | ||
</script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000 | ||
process.env.PORT = process.env.PORT || 5060 | ||
process.env.NODE_ENV = 'production' | ||
|
||
const { Nuxt, Builder } = require('nuxt') | ||
const request = require('request-promise-native') | ||
|
||
const config = require('./fixture/nuxt.config') | ||
|
||
const url = path => `http://localhost:${process.env.PORT}${path}` | ||
const url = path => `http://localhost:3000${path}` | ||
const get = path => request(url(path)) | ||
|
||
describe('Module', () => { | ||
describe('ssr', () => { | ||
let nuxt | ||
|
||
beforeAll(async () => { | ||
config.modules.unshift(function () { | ||
// Add test specific test only hooks on nuxt life cycle | ||
}) | ||
|
||
// Build a fresh nuxt | ||
nuxt = new Nuxt(config) | ||
await new Builder(nuxt).build() | ||
await nuxt.listen(process.env.PORT) | ||
}) | ||
await nuxt.listen(3000) | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
// Close all opened resources | ||
await nuxt.close() | ||
}) | ||
|
||
test('render', async () => { | ||
let html = await get('/') | ||
expect(html).toContain('Works!') | ||
}) | ||
|
||
test('sitemap', async () => { | ||
let xml = await get('/sitemap.xml') | ||
expect(xml).toContain('<loc>http://localhost:3000/</loc>') | ||
}) | ||
}) |
Oops, something went wrong.