Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit 4444600

Browse files
committed
Switch from jest to vitest
Switch to pnpm
1 parent f1626de commit 4444600

File tree

10 files changed

+3413
-7983
lines changed

10 files changed

+3413
-7983
lines changed

__tests__/commands/export.spec.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

__tests__/getFtlMessages.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, it, expect } from 'vitest'
2+
13
import { getFtlMessages } from '../src'
24

35
describe('getVueMessages', () => {
@@ -15,7 +17,7 @@ greeting = Hello, {$name}
1517

1618
// Assert
1719
expect(messages).toMatchInlineSnapshot(`
18-
Object {
20+
{
1921
"aria-key": "Aria value",
2022
"greeting": "Hello, { $name }
2123
.aria-label = Label value",
@@ -41,7 +43,7 @@ greeting = Hello, {$name}
4143

4244
// Assert
4345
expect(messages).toMatchInlineSnapshot(`
44-
Object {
46+
{
4547
"aria-key": "Aria value",
4648
"greeting": "Hello, { $name }
4749
.aria-label = Label value",

__tests__/getVueMessages.spec.ts

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, it, expect } from 'vitest'
2+
13
import { promises as fs } from 'fs'
24
import { resolve } from 'path'
35

@@ -14,18 +16,23 @@ describe('getVueMessages', () => {
1416
// Assert
1517
expect(messages).toHaveLength(1)
1618
expect(messages).toMatchInlineSnapshot(`
17-
Array [
18-
Object {
19-
"locale": "en",
20-
"messages": Object {
21-
"aria-key": "Aria value",
22-
"greeting": "Hello, { $name }
23-
.aria-label = Label value",
24-
"user-name": "World",
25-
},
26-
},
27-
]
28-
`)
19+
[
20+
{
21+
"locale": "en",
22+
"messages": {
23+
"aria-key": "Aria value",
24+
"greeting": "Hello, { \$name }
25+
.aria-label = Label value",
26+
"user-name": "World",
27+
},
28+
"source": "user-name = World
29+
aria-key = Aria value
30+
greeting = Hello, {\$name}
31+
.aria-label = Label value
32+
",
33+
},
34+
]
35+
`)
2936
})
3037

3138
it('extracts multiple SFC blocks', async () => {
@@ -38,27 +45,37 @@ Array [
3845
// Assert
3946
expect(messages).toHaveLength(2)
4047
expect(messages).toMatchInlineSnapshot(`
41-
Array [
42-
Object {
43-
"locale": "en",
44-
"messages": Object {
45-
"aria-key": "Aria value",
46-
"greeting": "Hello, { $name }
47-
.aria-label = Label value",
48-
"user-name": "World",
49-
},
50-
},
51-
Object {
52-
"locale": "uk",
53-
"messages": Object {
54-
"aria-key": "Значення aria",
55-
"greeting": "Привіт, { $name }
56-
.aria-label = Значення мітки",
57-
"user-name": "Світ",
58-
},
59-
},
60-
]
61-
`)
48+
[
49+
{
50+
"locale": "en",
51+
"messages": {
52+
"aria-key": "Aria value",
53+
"greeting": "Hello, { \$name }
54+
.aria-label = Label value",
55+
"user-name": "World",
56+
},
57+
"source": "user-name = World
58+
aria-key = Aria value
59+
greeting = Hello, {\$name}
60+
.aria-label = Label value
61+
",
62+
},
63+
{
64+
"locale": "uk",
65+
"messages": {
66+
"aria-key": "Значення aria",
67+
"greeting": "Привіт, { \$name }
68+
.aria-label = Значення мітки",
69+
"user-name": "Світ",
70+
},
71+
"source": "user-name = Світ
72+
aria-key = Значення aria
73+
greeting = Привіт, {\$name}
74+
.aria-label = Значення мітки
75+
",
76+
},
77+
]
78+
`)
6279
})
6380

6481
it('throws if fluent block does not have locale', () => {
@@ -99,15 +116,18 @@ fluent-key = fluent value
99116

100117
// Assert
101118
expect(messages).toMatchInlineSnapshot(`
102-
Array [
103-
Object {
104-
"locale": "en",
105-
"messages": Object {
106-
"fluent-key": "fluent value",
107-
"key": "value",
108-
},
109-
},
110-
]
111-
`)
119+
[
120+
{
121+
"locale": "en",
122+
"messages": {
123+
"fluent-key": "fluent value",
124+
"key": "value",
125+
},
126+
"source": "key = value
127+
fluent-key = fluent value
128+
",
129+
},
130+
]
131+
`)
112132
})
113133
})

__tests__/mergeFtl.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, it, expect } from 'vitest'
2+
13
import { mergeFtl } from '../src'
24

35
describe('mergeFtl', () => {

__tests__/mergeVue.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, it, expect } from 'vitest'
2+
13
import { promises as fs } from 'fs'
24
import { resolve } from 'path'
35

jest.config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,31 @@
3939
"postpack": "rm -f oclif.manifest.json",
4040
"posttest": "eslint . --ext .ts --config .eslintrc",
4141
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
42-
"test": "jest --runInBand",
42+
"test": "vitest run",
43+
"test:dev": "vitest",
4344
"version": "oclif-dev readme && git add README.md"
4445
},
4546
"types": "lib/index.d.ts",
4647
"devDependencies": {
47-
"@fluent/syntax": "0.17.0",
48-
"@oclif/dev-cli": "1.26.0",
49-
"@oclif/test": "1.2.8",
50-
"@types/jest": "^27.0.1",
51-
"@types/node": "10.17.60",
52-
"@typescript-eslint/eslint-plugin": "4.31.1",
53-
"@typescript-eslint/parser": "4.31.1",
54-
"@vue/compiler-dom": "3.2.11",
55-
"@vue/compiler-sfc": "3.2.11",
56-
"eslint": "5.16.0",
57-
"eslint-config-oclif": "3.1.0",
58-
"eslint-config-oclif-typescript": "0.1.0",
59-
"eslint-config-standard-with-typescript": "21.0.1",
60-
"eslint-plugin-import": "2.24.2",
61-
"eslint-plugin-node": "11.1.0",
62-
"eslint-plugin-promise": "5.1.0",
63-
"globby": "10.0.2",
64-
"jest": "27.2.0",
65-
"ts-jest": "27.0.5",
66-
"ts-node": "8.10.2",
67-
"typescript": "3.9.10"
48+
"@fluent/syntax": "^0.17.0",
49+
"@oclif/dev-cli": "^1",
50+
"@oclif/test": "^1",
51+
"@types/node": "^10.17.60",
52+
"@typescript-eslint/eslint-plugin": "^4.30.0",
53+
"@typescript-eslint/parser": "^4.30.0",
54+
"@vue/compiler-dom": "^3.2.6",
55+
"@vue/compiler-sfc": "^3.2.6",
56+
"eslint": "^5.13",
57+
"eslint-config-oclif": "^3.1",
58+
"eslint-config-oclif-typescript": "^0.1",
59+
"eslint-config-standard-with-typescript": "^21.0.1",
60+
"eslint-plugin-import": "^2.24.2",
61+
"eslint-plugin-node": "^11.1.0",
62+
"eslint-plugin-promise": "^5.1.0",
63+
"globby": "^10",
64+
"ts-node": "^8",
65+
"typescript": "^3.3",
66+
"vitest": "^0.3.6"
6867
},
6968
"engines": {
7069
"node": ">=8.0.0"

0 commit comments

Comments
 (0)