@taqueria/plugin-jest 0.0.0-pr-840-be4b450e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +107 -0
- package/index.js +112 -0
- package/index.js.map +1 -0
- package/index.ts +39 -0
- package/package.json +49 -0
- package/proxy.ts +116 -0
- package/tsconfig.json +101 -0
package/DESIGN.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Jest plugin for Taqueria
|
|
2
|
+
|
|
3
|
+
Authors: Michael Weichert <<michael.weichert@ecadlabs.com>>
|
|
4
|
+
|
|
5
|
+
Date: Apr 7, 2022
|
|
6
|
+
|
|
7
|
+
Revision: 1
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
This plugin integrates automated testing into your workflow via the Jest Testing Framework.
|
|
12
|
+
|
|
13
|
+
Our Jest plugin exposes the following tasks:
|
|
14
|
+
|
|
15
|
+
`taq test init [testsDir]`
|
|
16
|
+
|
|
17
|
+
Initializes the Jest plugin and Jest Testing Framework. Manual invocations of this task are not usually required, as uninitialzed test folders will be initialzed automatically. However, for explicit control, `taq test init` is available as a task for your convenience.
|
|
18
|
+
|
|
19
|
+
When executed, a _.taq/jest.config.js_ file is created if one doesn't exist, and then too, a _jest.config.js_ is created in _testsDir_ as specified in the positional arguments. _testsDir_ defaults to _jestTestsRootDir if no value was provided.
|
|
20
|
+
|
|
21
|
+
The _.taq/jest.config.js_ is known as the global jest configuration, and any other _jest.config.js_ files will inherit and override settings defined in the global jest configuration.
|
|
22
|
+
|
|
23
|
+
E.g, below is an example of a _jest.config.js_ file that would get created in your _jestTestsRootDir_:
|
|
24
|
+
```
|
|
25
|
+
module.exports = {
|
|
26
|
+
...require("/.taq/jest.config.js"),
|
|
27
|
+
// Set custom configuration here
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This assures that you can centralize Jest configuration settings that are global to your project, and yet allow granular and individual tweaks for particular use-cases.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
`taq test [testsDir] [pattern]`
|
|
35
|
+
|
|
36
|
+
The _test_ task is used to execute your automated tests using the Jest testing framework. Running `taq test` would scan the _jestTestsRootDir_ directory, which defaults to _./tests_. The __jestTestsRootDir_ is a configuration setting specified in your .taq/config.json, and may be changed at any time.
|
|
37
|
+
|
|
38
|
+
Running `taq test` without specifying a _testsDir_ will default to working with _jestTestsRootDir_. A pattern can be specified to pattern-match against filenames in the _testsDir_ to limit what automated tests are executed.
|
|
39
|
+
|
|
40
|
+
If the _jest.config.js_ file is missing in the specified _testsDir_, then `taq init [testsDir]` will be invoked automatically.
|
|
41
|
+
|
|
42
|
+
## Testing Directories / Partitions
|
|
43
|
+
|
|
44
|
+
Tests can be segmented into partitions, exposed as separate directories underneath the _jestTestsRootDir_ directory. This is sometimes desired to achieve a logical tree-like directory structure for organizational purposes. For instance, a developer may wish to segment their tests for smart contracts from the tests used to test a web application that interacts with the smart contract.
|
|
45
|
+
|
|
46
|
+
To do this, the developer could create two partitions:
|
|
47
|
+
|
|
48
|
+
`taq test contracts`
|
|
49
|
+
|
|
50
|
+
`taq test app`
|
|
51
|
+
|
|
52
|
+
This would create and initialize two partitions for writing Jest automated tests. Assuming your _jestTestsRootDir_ hasn't been customized, then it will default to _./tests_ and the directory structure will look like the following:
|
|
53
|
+
- tests
|
|
54
|
+
- tests/contracts
|
|
55
|
+
- tests/app
|
|
56
|
+
|
|
57
|
+
To run all automated tests in the contracts partition, a developer would run:
|
|
58
|
+
|
|
59
|
+
`taq test contracts`.
|
|
60
|
+
|
|
61
|
+
To run all tests, regardless of partition, a developer could run
|
|
62
|
+
|
|
63
|
+
`taq test`.
|
|
64
|
+
|
|
65
|
+
## Compatibility with other Testing Plugins
|
|
66
|
+
|
|
67
|
+
Its expected that other plugins will provide integration with testing frameworks other than Jest. For instance, the LIGO plugin is expected to provide integration with the LIGO Testing Framework which improve the developer workflow for smart contracts authored in one of many syntax available in the LIGO language.
|
|
68
|
+
|
|
69
|
+
For instance, a developer may wish to organize their tests as such:
|
|
70
|
+
- tests
|
|
71
|
+
- tests/contracts (using the LIGO testing framework)
|
|
72
|
+
- tests/app (using the Jest testing framework)
|
|
73
|
+
|
|
74
|
+
To do so, a developer would change their _jestTestsRootDir_ to _tests/app_ and _ligoTestsRootDir_ to _tests/contracts_.
|
|
75
|
+
|
|
76
|
+
A developer could run their tests written with LIGO with:
|
|
77
|
+
|
|
78
|
+
`taq test --plugin ligo`
|
|
79
|
+
|
|
80
|
+
Likewise, for Jest a developer would run:
|
|
81
|
+
|
|
82
|
+
`taq test --plugin jest`
|
|
83
|
+
|
|
84
|
+
## Future considerations
|
|
85
|
+
|
|
86
|
+
### End-developer defined tasks
|
|
87
|
+
|
|
88
|
+
As first mentioned in the State Architecture Design Document, a developer should have the ability to define their own tasks that can integrated into their workflow.
|
|
89
|
+
|
|
90
|
+
End-developer defined tasks are configurated in _.taq/config.json_.
|
|
91
|
+
|
|
92
|
+
This capability offers the ability to define a task which wraps existing ones.
|
|
93
|
+
|
|
94
|
+
E.g.:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
...,
|
|
98
|
+
"tasks": {
|
|
99
|
+
"test": {
|
|
100
|
+
"handler": "taq test --plugin ligo && taq test --plugin ligo"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This would expose a task that would run all tests defined using the LIGO and Jest plugin:
|
|
106
|
+
|
|
107
|
+
`taq run test`
|
package/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {Plugin as $d3MIr$Plugin, Task as $d3MIr$Task, PositionalArg as $d3MIr$PositionalArg, Option as $d3MIr$Option, sendAsyncErr as $d3MIr$sendAsyncErr, sendErr as $d3MIr$sendErr, sendAsyncRes as $d3MIr$sendAsyncRes} from "@taqueria/node-sdk";
|
|
2
|
+
import {SanitizedAbsPath as $d3MIr$SanitizedAbsPath} from "@taqueria/node-sdk/types";
|
|
3
|
+
import {execa as $d3MIr$execa} from "execa";
|
|
4
|
+
import {stat as $d3MIr$stat, writeFile as $d3MIr$writeFile, mkdir as $d3MIr$mkdir} from "fs/promises";
|
|
5
|
+
import {defaults as $d3MIr$defaults} from "jest-config";
|
|
6
|
+
import {join as $d3MIr$join} from "path";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const $74485658d1dbcd36$var$getDefaultConfig = (defaultConfig)=>`
|
|
16
|
+
module.exports = ${JSON.stringify((0, $d3MIr$defaults), null, 4)}
|
|
17
|
+
`;
|
|
18
|
+
const $74485658d1dbcd36$var$ensureRootConfigExists = (projectDir)=>{
|
|
19
|
+
const jestRootConfig = $74485658d1dbcd36$var$getRootConfigAbspath(projectDir);
|
|
20
|
+
return (0, $d3MIr$stat)(jestRootConfig).catch((_)=>(0, $d3MIr$writeFile)(jestRootConfig, $74485658d1dbcd36$var$getDefaultConfig((0, $d3MIr$defaults)))).then((_)=>jestRootConfig);
|
|
21
|
+
};
|
|
22
|
+
const $74485658d1dbcd36$var$getRootConfigAbspath = (projectDir)=>(0, $d3MIr$SanitizedAbsPath).create((0, $d3MIr$join)(projectDir, ".taq", "jest.config.js"));
|
|
23
|
+
const $74485658d1dbcd36$var$getTestsRootDir = (config)=>{
|
|
24
|
+
return config.jestTestsRootDir || "tests";
|
|
25
|
+
};
|
|
26
|
+
const $74485658d1dbcd36$var$toPartitionCfg = (partitionAbspath, rootConfigAbsPath)=>`
|
|
27
|
+
const parentConfig = require('${rootConfigAbsPath}')
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
...parentConfig,
|
|
31
|
+
roots: [
|
|
32
|
+
"${partitionAbspath}"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const $74485658d1dbcd36$var$getPartitionAbspath = (partitionDir)=>(0, $d3MIr$SanitizedAbsPath).create(partitionDir);
|
|
37
|
+
const $74485658d1dbcd36$var$getPartitionConfigAbspath = (partitionDir)=>(0, $d3MIr$SanitizedAbsPath).create((0, $d3MIr$join)(partitionDir, "jest.config.js"));
|
|
38
|
+
const $74485658d1dbcd36$var$createPartition = async (partitionDir, projectDir)=>$74485658d1dbcd36$var$ensureRootConfigExists(projectDir).then((_)=>(0, $d3MIr$stat)(partitionDir)).then((stats)=>stats.isFile() ? (0, $d3MIr$sendAsyncErr)(`${partitionDir} is an invalid partition directory`) : stats).catch((_)=>(0, $d3MIr$mkdir)(partitionDir, {
|
|
39
|
+
recursive: true
|
|
40
|
+
})).then((_)=>$74485658d1dbcd36$var$getPartitionConfigAbspath(partitionDir)).then((partitionCfgAbsPath)=>(0, $d3MIr$stat)(partitionCfgAbsPath).catch((_)=>(0, $d3MIr$writeFile)(partitionCfgAbsPath, $74485658d1dbcd36$var$toPartitionCfg($74485658d1dbcd36$var$getPartitionAbspath(partitionDir), $74485658d1dbcd36$var$getRootConfigAbspath(projectDir))))).then((_)=>$74485658d1dbcd36$var$getPartitionConfigAbspath(partitionDir));
|
|
41
|
+
const $74485658d1dbcd36$var$ensurePartitionExists = (args)=>args.partition ? $74485658d1dbcd36$var$createPartition((0, $d3MIr$SanitizedAbsPath).create((0, $d3MIr$join)(args.projectDir, args.partition)), args.projectDir) : $74485658d1dbcd36$var$createPartition((0, $d3MIr$SanitizedAbsPath).create((0, $d3MIr$join)(args.projectDir, $74485658d1dbcd36$var$getTestsRootDir(args.config))), args.projectDir);
|
|
42
|
+
const $74485658d1dbcd36$var$execCmd = (cmd, args)=>{
|
|
43
|
+
return (0, $d3MIr$execa)(cmd, args, {
|
|
44
|
+
reject: false
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var $74485658d1dbcd36$export$2e2bcd8739ae039 = async (args)=>{
|
|
48
|
+
const opts = args;
|
|
49
|
+
return $74485658d1dbcd36$var$ensurePartitionExists(opts).then((configAbsPath)=>{
|
|
50
|
+
if (!opts.init) {
|
|
51
|
+
const cmd = opts.testPattern ? $74485658d1dbcd36$var$execCmd("npx", [
|
|
52
|
+
"jest",
|
|
53
|
+
"-c",
|
|
54
|
+
configAbsPath,
|
|
55
|
+
"-t",
|
|
56
|
+
opts.testPattern
|
|
57
|
+
]) : $74485658d1dbcd36$var$execCmd("npx", [
|
|
58
|
+
"jest",
|
|
59
|
+
"-c",
|
|
60
|
+
configAbsPath
|
|
61
|
+
]);
|
|
62
|
+
return cmd.then(({ stdout: stdout , stderr: stderr })=>{
|
|
63
|
+
if (stderr) (0, $d3MIr$sendErr)(stderr);
|
|
64
|
+
return (0, $d3MIr$sendAsyncRes)(stdout);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return (0, $d3MIr$sendAsyncRes)("Initialized successfully.");
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
(0, $d3MIr$Plugin).create(()=>({
|
|
73
|
+
schema: "0.1",
|
|
74
|
+
version: "0.4.0",
|
|
75
|
+
alias: "jest",
|
|
76
|
+
tasks: [
|
|
77
|
+
(0, $d3MIr$Task).create({
|
|
78
|
+
task: "test",
|
|
79
|
+
command: "test [partition]",
|
|
80
|
+
description: "Setup a directory as a partition to run Jest tests",
|
|
81
|
+
aliases: [
|
|
82
|
+
"jest"
|
|
83
|
+
],
|
|
84
|
+
handler: "proxy",
|
|
85
|
+
positionals: [
|
|
86
|
+
(0, $d3MIr$PositionalArg).create({
|
|
87
|
+
placeholder: "partition",
|
|
88
|
+
description: "Name of the partition for these tests",
|
|
89
|
+
defaultValue: "tests",
|
|
90
|
+
type: "string"
|
|
91
|
+
}),
|
|
92
|
+
],
|
|
93
|
+
options: [
|
|
94
|
+
(0, $d3MIr$Option).create({
|
|
95
|
+
flag: "init",
|
|
96
|
+
shortFlag: "i",
|
|
97
|
+
description: "Initializes the partition for Jest",
|
|
98
|
+
boolean: true
|
|
99
|
+
}),
|
|
100
|
+
(0, $d3MIr$Option).create({
|
|
101
|
+
flag: "testPattern",
|
|
102
|
+
description: "Run test files that match the provided pattern",
|
|
103
|
+
boolean: true
|
|
104
|
+
}),
|
|
105
|
+
]
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
108
|
+
proxy: $74485658d1dbcd36$export$2e2bcd8739ae039
|
|
109
|
+
}), process.argv);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["taqueria-plugin-jest/index.ts","taqueria-plugin-jest/proxy.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task } from '@taqueria/node-sdk';\nimport proxy from './proxy';\n\nPlugin.create(() => ({\n\tschema: '0.1',\n\tversion: '0.4.0',\n\talias: 'jest',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test [partition]',\n\t\t\tdescription: 'Setup a directory as a partition to run Jest tests',\n\t\t\taliases: ['jest'],\n\t\t\thandler: 'proxy',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'partition',\n\t\t\t\t\tdescription: 'Name of the partition for these tests',\n\t\t\t\t\tdefaultValue: 'tests',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'init',\n\t\t\t\t\tshortFlag: 'i',\n\t\t\t\t\tdescription: 'Initializes the partition for Jest',\n\t\t\t\t\tboolean: true,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'testPattern',\n\t\t\t\t\tdescription: 'Run test files that match the provided pattern',\n\t\t\t\t\tboolean: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t}),\n\t],\n\tproxy,\n}), process.argv);\n","import { sendAsyncErr, sendAsyncRes, sendErr } from '@taqueria/node-sdk';\nimport { LoadedConfig, RequestArgs, SanitizedAbsPath } from '@taqueria/node-sdk/types';\nimport { execa } from 'execa';\nimport { mkdir, stat, writeFile } from 'fs/promises';\nimport { defaults } from 'jest-config';\nimport { join } from 'path';\n\ntype DefaultConfig = typeof defaults;\n\ninterface CustomConfig extends LoadedConfig.t {\n\treadonly jestTestsRootDir?: string;\n}\n\ninterface Opts extends RequestArgs.ProxyRequestArgs {\n\treadonly config: CustomConfig;\n\treadonly init: boolean;\n\treadonly partition: string;\n\treadonly testPattern: string;\n}\n\nconst getDefaultConfig = (defaultConfig: DefaultConfig) => `\nmodule.exports = ${JSON.stringify(defaults, null, 4)}\n`;\n\nconst ensureRootConfigExists = (projectDir: SanitizedAbsPath.t) => {\n\tconst jestRootConfig = getRootConfigAbspath(projectDir);\n\treturn stat(jestRootConfig)\n\t\t.catch(_ => writeFile(jestRootConfig, getDefaultConfig(defaults)))\n\t\t.then(_ => jestRootConfig);\n};\n\nconst getRootConfigAbspath = (projectDir: SanitizedAbsPath.t) =>\n\tSanitizedAbsPath.create(\n\t\tjoin(projectDir, '.taq', 'jest.config.js'),\n\t);\n\nconst getTestsRootDir = (config: CustomConfig) => {\n\treturn config.jestTestsRootDir || 'tests';\n};\n\nconst toPartitionCfg = (partitionAbspath: SanitizedAbsPath.t, rootConfigAbsPath: SanitizedAbsPath.t) => `\nconst parentConfig = require('${rootConfigAbsPath}')\n\nmodule.exports = {\n ...parentConfig,\n roots: [\n \"${partitionAbspath}\"\n ]\n}\n`;\n\nconst getPartitionAbspath = (partitionDir: string) => SanitizedAbsPath.create(partitionDir);\n\nconst getPartitionConfigAbspath = (partitionDir: string) =>\n\tSanitizedAbsPath.create(join(partitionDir, 'jest.config.js'));\n\nconst createPartition = async (partitionDir: SanitizedAbsPath.t, projectDir: SanitizedAbsPath.t) =>\n\tensureRootConfigExists(projectDir)\n\t\t.then(_ => stat(partitionDir))\n\t\t.then(stats =>\n\t\t\tstats.isFile()\n\t\t\t\t? sendAsyncErr(`${partitionDir} is an invalid partition directory`)\n\t\t\t\t: stats\n\t\t)\n\t\t.catch(_ => mkdir(partitionDir, { recursive: true }))\n\t\t.then(_ => getPartitionConfigAbspath(partitionDir))\n\t\t.then(partitionCfgAbsPath =>\n\t\t\tstat(partitionCfgAbsPath)\n\t\t\t\t.catch(_ =>\n\t\t\t\t\twriteFile(\n\t\t\t\t\t\tpartitionCfgAbsPath,\n\t\t\t\t\t\ttoPartitionCfg(\n\t\t\t\t\t\t\tgetPartitionAbspath(partitionDir),\n\t\t\t\t\t\t\tgetRootConfigAbspath(projectDir),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t)\n\t\t.then(_ => getPartitionConfigAbspath(partitionDir));\n\nconst ensurePartitionExists = (args: Opts) =>\n\targs.partition\n\t\t? createPartition(\n\t\t\tSanitizedAbsPath.create(join(args.projectDir, args.partition)),\n\t\t\targs.projectDir,\n\t\t)\n\t\t: createPartition(\n\t\t\tSanitizedAbsPath.create(\n\t\t\t\tjoin(args.projectDir, getTestsRootDir(args.config)),\n\t\t\t),\n\t\t\targs.projectDir,\n\t\t);\n\nconst execCmd = (cmd: string, args: string[]) => {\n\treturn execa(cmd, args, { reject: false });\n};\n\nexport default async (args: RequestArgs.ProxyRequestArgs) => {\n\tconst opts = args as Opts;\n\n\treturn ensurePartitionExists(opts)\n\t\t.then(configAbsPath => {\n\t\t\tif (!opts.init) {\n\t\t\t\tconst cmd = opts.testPattern\n\t\t\t\t\t? execCmd('npx', ['jest', '-c', configAbsPath, '-t', opts.testPattern])\n\t\t\t\t\t: execCmd('npx', ['jest', '-c', configAbsPath]);\n\n\t\t\t\treturn cmd.then(({ stdout, stderr }) => {\n\t\t\t\t\tif (stderr) sendErr(stderr);\n\t\t\t\t\treturn sendAsyncRes(stdout);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn sendAsyncRes('Initialized successfully.');\n\t\t});\n};\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Option, Plugin, PositionalArg, Task } from '@taqueria/node-sdk';
|
|
2
|
+
import proxy from './proxy';
|
|
3
|
+
|
|
4
|
+
Plugin.create(() => ({
|
|
5
|
+
schema: '0.1',
|
|
6
|
+
version: '0.4.0',
|
|
7
|
+
alias: 'jest',
|
|
8
|
+
tasks: [
|
|
9
|
+
Task.create({
|
|
10
|
+
task: 'test',
|
|
11
|
+
command: 'test [partition]',
|
|
12
|
+
description: 'Setup a directory as a partition to run Jest tests',
|
|
13
|
+
aliases: ['jest'],
|
|
14
|
+
handler: 'proxy',
|
|
15
|
+
positionals: [
|
|
16
|
+
PositionalArg.create({
|
|
17
|
+
placeholder: 'partition',
|
|
18
|
+
description: 'Name of the partition for these tests',
|
|
19
|
+
defaultValue: 'tests',
|
|
20
|
+
type: 'string',
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
options: [
|
|
24
|
+
Option.create({
|
|
25
|
+
flag: 'init',
|
|
26
|
+
shortFlag: 'i',
|
|
27
|
+
description: 'Initializes the partition for Jest',
|
|
28
|
+
boolean: true,
|
|
29
|
+
}),
|
|
30
|
+
Option.create({
|
|
31
|
+
flag: 'testPattern',
|
|
32
|
+
description: 'Run test files that match the provided pattern',
|
|
33
|
+
boolean: true,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
proxy,
|
|
39
|
+
}), process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taqueria/plugin-jest",
|
|
3
|
+
"version": "0.0.0-pr-840-be4b450e",
|
|
4
|
+
"description": "A plugin for Taqueria providing automated testing using the Jest Testing Framework",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"taqueria",
|
|
7
|
+
"plugin",
|
|
8
|
+
"jest",
|
|
9
|
+
"testing",
|
|
10
|
+
"tdd",
|
|
11
|
+
"ecad",
|
|
12
|
+
"ecadlabs",
|
|
13
|
+
"tezos"
|
|
14
|
+
],
|
|
15
|
+
"targets": {
|
|
16
|
+
"default": {
|
|
17
|
+
"source": "./index.ts",
|
|
18
|
+
"distDir": "./",
|
|
19
|
+
"context": "node",
|
|
20
|
+
"isLibrary": true,
|
|
21
|
+
"outputFormat": "esmodule"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "npx tsc -noEmit -p ./tsconfig.json && npx parcel build --no-cache 2>&1"
|
|
26
|
+
},
|
|
27
|
+
"author": "ECAD Labs",
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/ecadlabs/taqueria.git",
|
|
33
|
+
"directory": "taqueria-plugin-jest"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@taqueria/node-sdk": "^0.4.0",
|
|
37
|
+
"async-retry": "^1.3.3",
|
|
38
|
+
"execa": "^6.1.0",
|
|
39
|
+
"fast-glob": "^3.2.7",
|
|
40
|
+
"jest-cli": "^28.1.0",
|
|
41
|
+
"jest-config": "^28.1.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/async-retry": "^1.3.3",
|
|
45
|
+
"@types/jest": "^27.5.1",
|
|
46
|
+
"parcel": "^2.6.0",
|
|
47
|
+
"typescript": "4.7.2"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/proxy.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { sendAsyncErr, sendAsyncRes, sendErr } from '@taqueria/node-sdk';
|
|
2
|
+
import { LoadedConfig, RequestArgs, SanitizedAbsPath } from '@taqueria/node-sdk/types';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
import { mkdir, stat, writeFile } from 'fs/promises';
|
|
5
|
+
import { defaults } from 'jest-config';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
type DefaultConfig = typeof defaults;
|
|
9
|
+
|
|
10
|
+
interface CustomConfig extends LoadedConfig.t {
|
|
11
|
+
readonly jestTestsRootDir?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Opts extends RequestArgs.ProxyRequestArgs {
|
|
15
|
+
readonly config: CustomConfig;
|
|
16
|
+
readonly init: boolean;
|
|
17
|
+
readonly partition: string;
|
|
18
|
+
readonly testPattern: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const getDefaultConfig = (defaultConfig: DefaultConfig) => `
|
|
22
|
+
module.exports = ${JSON.stringify(defaults, null, 4)}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const ensureRootConfigExists = (projectDir: SanitizedAbsPath.t) => {
|
|
26
|
+
const jestRootConfig = getRootConfigAbspath(projectDir);
|
|
27
|
+
return stat(jestRootConfig)
|
|
28
|
+
.catch(_ => writeFile(jestRootConfig, getDefaultConfig(defaults)))
|
|
29
|
+
.then(_ => jestRootConfig);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getRootConfigAbspath = (projectDir: SanitizedAbsPath.t) =>
|
|
33
|
+
SanitizedAbsPath.create(
|
|
34
|
+
join(projectDir, '.taq', 'jest.config.js'),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const getTestsRootDir = (config: CustomConfig) => {
|
|
38
|
+
return config.jestTestsRootDir || 'tests';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const toPartitionCfg = (partitionAbspath: SanitizedAbsPath.t, rootConfigAbsPath: SanitizedAbsPath.t) => `
|
|
42
|
+
const parentConfig = require('${rootConfigAbsPath}')
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
...parentConfig,
|
|
46
|
+
roots: [
|
|
47
|
+
"${partitionAbspath}"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const getPartitionAbspath = (partitionDir: string) => SanitizedAbsPath.create(partitionDir);
|
|
53
|
+
|
|
54
|
+
const getPartitionConfigAbspath = (partitionDir: string) =>
|
|
55
|
+
SanitizedAbsPath.create(join(partitionDir, 'jest.config.js'));
|
|
56
|
+
|
|
57
|
+
const createPartition = async (partitionDir: SanitizedAbsPath.t, projectDir: SanitizedAbsPath.t) =>
|
|
58
|
+
ensureRootConfigExists(projectDir)
|
|
59
|
+
.then(_ => stat(partitionDir))
|
|
60
|
+
.then(stats =>
|
|
61
|
+
stats.isFile()
|
|
62
|
+
? sendAsyncErr(`${partitionDir} is an invalid partition directory`)
|
|
63
|
+
: stats
|
|
64
|
+
)
|
|
65
|
+
.catch(_ => mkdir(partitionDir, { recursive: true }))
|
|
66
|
+
.then(_ => getPartitionConfigAbspath(partitionDir))
|
|
67
|
+
.then(partitionCfgAbsPath =>
|
|
68
|
+
stat(partitionCfgAbsPath)
|
|
69
|
+
.catch(_ =>
|
|
70
|
+
writeFile(
|
|
71
|
+
partitionCfgAbsPath,
|
|
72
|
+
toPartitionCfg(
|
|
73
|
+
getPartitionAbspath(partitionDir),
|
|
74
|
+
getRootConfigAbspath(projectDir),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
.then(_ => getPartitionConfigAbspath(partitionDir));
|
|
80
|
+
|
|
81
|
+
const ensurePartitionExists = (args: Opts) =>
|
|
82
|
+
args.partition
|
|
83
|
+
? createPartition(
|
|
84
|
+
SanitizedAbsPath.create(join(args.projectDir, args.partition)),
|
|
85
|
+
args.projectDir,
|
|
86
|
+
)
|
|
87
|
+
: createPartition(
|
|
88
|
+
SanitizedAbsPath.create(
|
|
89
|
+
join(args.projectDir, getTestsRootDir(args.config)),
|
|
90
|
+
),
|
|
91
|
+
args.projectDir,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const execCmd = (cmd: string, args: string[]) => {
|
|
95
|
+
return execa(cmd, args, { reject: false });
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default async (args: RequestArgs.ProxyRequestArgs) => {
|
|
99
|
+
const opts = args as Opts;
|
|
100
|
+
|
|
101
|
+
return ensurePartitionExists(opts)
|
|
102
|
+
.then(configAbsPath => {
|
|
103
|
+
if (!opts.init) {
|
|
104
|
+
const cmd = opts.testPattern
|
|
105
|
+
? execCmd('npx', ['jest', '-c', configAbsPath, '-t', opts.testPattern])
|
|
106
|
+
: execCmd('npx', ['jest', '-c', configAbsPath]);
|
|
107
|
+
|
|
108
|
+
return cmd.then(({ stdout, stderr }) => {
|
|
109
|
+
if (stderr) sendErr(stderr);
|
|
110
|
+
return sendAsyncRes(stdout);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return sendAsyncRes('Initialized successfully.');
|
|
115
|
+
});
|
|
116
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "CommonJS", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
"isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
}
|
|
101
|
+
}
|