Skip to content

Commit e4bcfb1

Browse files
committed
merge
2 parents c3b041c + 1af3698 commit e4bcfb1

13 files changed

+2118
-98
lines changed

.circleci/config.yml

-46
This file was deleted.

.eslintrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
module.exports = {
44
root: true,
5+
globals: {
6+
page: true,
7+
browser: true,
8+
context: true,
9+
jestPuppeteer: true
10+
},
511
env: {
612
node: true,
713
jest: true

.github/workflows/test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test
2+
on:
3+
push:
4+
branches-ignore:
5+
- gh-pages
6+
pull_request:
7+
env:
8+
CI: true
9+
10+
jobs:
11+
test:
12+
name: "Test on Node.js ${{ matrix.node }} OS: ${{matrix.os}}"
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
node: [10, 12]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Setup Node.js ${{ matrix.node }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node }}
25+
- name: Install
26+
run: yarn install
27+
- name: Test
28+
run: yarn test

e2e/example.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('example', () => {
2+
beforeAll(async () => {
3+
await page.goto('http://localhost:8080/')
4+
})
5+
6+
test('rendering', async () => {
7+
await expect(page).toMatch('こんにちは、世界!')
8+
})
9+
})

example/App.vue

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<p>{{ $t('hello') }}</p>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: 'App'
8+
}
9+
</script>
10+
11+
<i18n>
12+
{
13+
"en": {
14+
"hello": "hello, world!"
15+
},
16+
"ja": {
17+
"hello": "こんにちは、世界!"
18+
}
19+
}
20+
</i18n>

example/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>vue-i18n-loader example</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script src="/dist/bundle.js"></script>
10+
</body>
11+
</html>

example/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Vue from 'vue'
2+
import VueI18n from 'vue-i18n'
3+
import App from './App.vue'
4+
5+
Vue.use(VueI18n)
6+
7+
const i18n = new VueI18n({
8+
locale: 'ja',
9+
messages: {}
10+
})
11+
12+
new Vue({
13+
i18n,
14+
el: '#app',
15+
render: h => h(App)
16+
})

example/webpack.config.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const path = require('path')
2+
const VueLoaderPlugin = require('vue-loader/lib/plugin')
3+
4+
module.exports = {
5+
mode: 'development',
6+
entry: path.resolve(__dirname, './main.js'),
7+
output: {
8+
path: path.resolve(__dirname, 'dist'),
9+
filename: 'bundle.js',
10+
publicPath: '/dist/'
11+
},
12+
devServer: {
13+
stats: 'minimal',
14+
contentBase: __dirname
15+
},
16+
module: {
17+
rules: [
18+
{
19+
test: /\.vue$/,
20+
loader: 'vue-loader'
21+
},
22+
{
23+
test: /\.js$/,
24+
loader: 'babel-loader'
25+
},
26+
{
27+
resourceQuery: /blockType=i18n/,
28+
type: 'javascript/auto',
29+
use: [path.resolve(__dirname, '../lib/index.js')]
30+
}
31+
]
32+
},
33+
plugins: [new VueLoaderPlugin()]
34+
}

jest-puppeteer.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
server: {
3+
port: 8080,
4+
command:
5+
'webpack-dev-server --config example/webpack.config.js --inline --hot'
6+
},
7+
launch: {
8+
dumpio: false,
9+
headless: process.env.HEADLESS !== 'false'
10+
},
11+
browser: 'chromium',
12+
browserContext: 'default'
13+
}

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
preset: 'ts-jest',
55
testEnvironment: 'node',
66
coveragePathIgnorePatterns: ['node_modules', '<rootDir>/test/*.*'],
7+
testMatch: ['<rootDir>/test/**/*(*.)@(spec|test).[tj]s?(x)'],
78
globals: {
89
'ts-jest': {
910
diagnostics: false

jest.e2e.config.js

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after `n` failures
9+
// bail: 0,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/private/var/folders/dr/y00s2v7d6xs144hbxgl5z2cw0000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
clearMocks: true,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: false,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: null,
25+
26+
// The directory where Jest should output its coverage files
27+
// coverageDirectory: 'coverage',
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// '/node_modules/',
32+
// '<rootDir>/test/*.*'
33+
// ],
34+
35+
// A list of reporter names that Jest uses when writing coverage reports
36+
// coverageReporters: [
37+
// "json",
38+
// "text",
39+
// "lcov",
40+
// "clover"
41+
// ],
42+
43+
// An object that configures minimum threshold enforcement for coverage results
44+
// coverageThreshold: null,
45+
46+
// A path to a custom dependency extractor
47+
// dependencyExtractor: null,
48+
49+
// Make calling deprecated APIs throw helpful error messages
50+
// errorOnDeprecated: false,
51+
52+
// Force coverage collection from ignored files using an array of glob patterns
53+
// forceCoverageMatch: [],
54+
55+
// A path to a module which exports an async function that is triggered once before all test suites
56+
// globalSetup: null,
57+
58+
// A path to a module which exports an async function that is triggered once after all test suites
59+
// globalTeardown: null,
60+
61+
// A set of global variables that need to be available in all test environments
62+
// globals: {},
63+
64+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
65+
// maxWorkers: "50%",
66+
67+
// An array of directory names to be searched recursively up from the requiring module's location
68+
// moduleDirectories: [
69+
// "node_modules"
70+
// ],
71+
72+
// An array of file extensions your modules use
73+
// moduleFileExtensions: [
74+
// "js",
75+
// "json",
76+
// "jsx",
77+
// "ts",
78+
// "tsx",
79+
// "node"
80+
// ],
81+
82+
// A map from regular expressions to module names that allow to stub out resources with a single module
83+
// moduleNameMapper: {},
84+
85+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
86+
// modulePathIgnorePatterns: [],
87+
88+
// Activates notifications for test results
89+
// notify: false,
90+
91+
// An enum that specifies notification mode. Requires { notify: true }
92+
// notifyMode: "failure-change",
93+
94+
// A preset that is used as a base for Jest's configuration
95+
preset: 'jest-puppeteer',
96+
97+
// Run tests from one or more projects
98+
// projects: null,
99+
100+
// Use this configuration option to add custom reporters to Jest
101+
// reporters: undefined,
102+
103+
// Automatically reset mock state between every test
104+
// resetMocks: false,
105+
106+
// Reset the module registry before running each individual test
107+
// resetModules: false,
108+
109+
// A path to a custom resolver
110+
// resolver: null,
111+
112+
// Automatically restore mock state between every test
113+
// restoreMocks: false,
114+
115+
// The root directory that Jest should scan for tests and modules within
116+
// rootDir: null,
117+
118+
// A list of paths to directories that Jest should use to search for files in
119+
// roots: [
120+
// "<rootDir>"
121+
// ],
122+
123+
// Allows you to use a custom runner instead of Jest's default test runner
124+
// runner: "jest-runner",
125+
126+
// The paths to modules that run some code to configure or set up the testing environment before each test
127+
// setupFiles: [],
128+
129+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
130+
// setupFilesAfterEnv: [],
131+
132+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
133+
// snapshotSerializers: [],
134+
135+
// The test environment that will be used for testing
136+
// testEnvironment: 'node',
137+
138+
// Options that will be passed to the testEnvironment
139+
// testEnvironmentOptions: {},
140+
141+
// Adds a location field to test results
142+
// testLocationInResults: false,
143+
144+
// The glob patterns Jest uses to detect test files
145+
testMatch: ['<rootDir>/e2e/**/*(*.)@(spec|test).js']
146+
147+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
148+
// testPathIgnorePatterns: [
149+
// "/node_modules/"
150+
// ],
151+
152+
// The regexp pattern or array of patterns that Jest uses to detect test files
153+
// testRegex: [],
154+
155+
// This option allows the use of a custom results processor
156+
// testResultsProcessor: null,
157+
158+
// This option allows use of a custom test runner
159+
// testRunner: "jasmine2",
160+
161+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
162+
// testURL: "http://localhost",
163+
164+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
165+
// timers: "real",
166+
167+
// A map from regular expressions to paths to transformers
168+
// transform: {
169+
// '^.+\\.ts?$': 'ts-jest'
170+
// },
171+
172+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
173+
// transformIgnorePatterns: [
174+
// "/node_modules/"
175+
// ],
176+
177+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
178+
// unmockedModulePathPatterns: undefined,
179+
180+
// Indicates whether each individual test should be reported during the run
181+
// verbose: null,
182+
183+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
184+
// watchPathIgnorePatterns: [],
185+
186+
// Whether to use watchman for file crawling
187+
// watchman: true,
188+
189+
// watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname']
190+
}

0 commit comments

Comments
 (0)