@taqueria/plugin-jest 0.4.0-rc1 → 0.4.0
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/index.js +25 -22
- package/index.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/proxy.ts +14 -8
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Plugin as $d3MIr$Plugin, Task as $d3MIr$Task, PositionalArg as $d3MIr$PositionalArg, Option as $d3MIr$Option, sendAsyncErr as $d3MIr$sendAsyncErr,
|
|
1
|
+
import {Plugin as $d3MIr$Plugin, Task as $d3MIr$Task, PositionalArg as $d3MIr$PositionalArg, Option as $d3MIr$Option, sendAsyncErr as $d3MIr$sendAsyncErr, sendAsyncRes as $d3MIr$sendAsyncRes} from "@taqueria/node-sdk";
|
|
2
2
|
import {SanitizedAbsPath as $d3MIr$SanitizedAbsPath} from "@taqueria/node-sdk/types";
|
|
3
3
|
import {execa as $d3MIr$execa} from "execa";
|
|
4
4
|
import {stat as $d3MIr$stat, writeFile as $d3MIr$writeFile, mkdir as $d3MIr$mkdir} from "fs/promises";
|
|
@@ -40,30 +40,33 @@ const $74485658d1dbcd36$var$createPartition = async (partitionDir, projectDir)=>
|
|
|
40
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
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
42
|
const $74485658d1dbcd36$var$execCmd = (cmd, args)=>{
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// console.log([cmd, ...args].join(' '))
|
|
44
|
+
const child = (0, $d3MIr$execa)(cmd, args, {
|
|
45
|
+
reject: false,
|
|
46
|
+
buffer: false,
|
|
47
|
+
// encoding: null,
|
|
48
|
+
shell: true,
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
env: {
|
|
51
|
+
FORCE_COLOR: "true"
|
|
52
|
+
}
|
|
45
53
|
});
|
|
54
|
+
return child.then((_)=>{});
|
|
46
55
|
};
|
|
47
56
|
var $74485658d1dbcd36$export$2e2bcd8739ae039 = async (args)=>{
|
|
48
57
|
const opts = args;
|
|
49
58
|
return $74485658d1dbcd36$var$ensurePartitionExists(opts).then((configAbsPath)=>{
|
|
50
|
-
if (!opts.init)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]);
|
|
62
|
-
return cmd.then(({ stdout: stdout , stderr: stderr })=>{
|
|
63
|
-
if (stderr) (0, $d3MIr$sendErr)(stderr);
|
|
64
|
-
return (0, $d3MIr$sendAsyncRes)(stdout);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
59
|
+
if (!opts.init) return opts.testPattern ? $74485658d1dbcd36$var$execCmd("npx", [
|
|
60
|
+
"jest",
|
|
61
|
+
"-c",
|
|
62
|
+
configAbsPath,
|
|
63
|
+
"--testPathPattern",
|
|
64
|
+
opts.testPattern
|
|
65
|
+
]) : $74485658d1dbcd36$var$execCmd("npx", [
|
|
66
|
+
"jest",
|
|
67
|
+
"-c",
|
|
68
|
+
configAbsPath
|
|
69
|
+
]);
|
|
67
70
|
return (0, $d3MIr$sendAsyncRes)("Initialized successfully.");
|
|
68
71
|
});
|
|
69
72
|
};
|
|
@@ -99,8 +102,8 @@ var $74485658d1dbcd36$export$2e2bcd8739ae039 = async (args)=>{
|
|
|
99
102
|
}),
|
|
100
103
|
(0, $d3MIr$Option).create({
|
|
101
104
|
flag: "testPattern",
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
shortFlag: "t",
|
|
106
|
+
description: "Run test files that match the provided pattern"
|
|
104
107
|
}),
|
|
105
108
|
]
|
|
106
109
|
}),
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;ACAA;;;;;;AAoBA,MAAM,sCAAgB,GAAG,CAAC,aAA4B,GAAK,CAAC;iBAC3C,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA,GAAA,eAAQ,CAAA,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC,AAAC;AAEF,MAAM,4CAAsB,GAAG,CAAC,UAA8B,GAAK;IAClE,MAAM,cAAc,GAAG,0CAAoB,CAAC,UAAU,CAAC,AAAC;IACxD,OAAO,CAAA,GAAA,WAAI,CAAA,CAAC,cAAc,CAAC,CACzB,KAAK,CAAC,CAAA,CAAC,GAAI,CAAA,GAAA,gBAAS,CAAA,CAAC,cAAc,EAAE,sCAAgB,CAAC,CAAA,GAAA,eAAQ,CAAA,CAAC,CAAC,CAAC,CACjE,IAAI,CAAC,CAAA,CAAC,GAAI,cAAc,CAAC,CAAC;CAC5B,AAAC;AAEF,MAAM,0CAAoB,GAAG,CAAC,UAA8B,GAC3D,CAAA,GAAA,uBAAgB,CAAA,CAAC,MAAM,CACtB,CAAA,GAAA,WAAI,CAAA,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAC1C,AAAC;AAEH,MAAM,qCAAe,GAAG,CAAC,MAAoB,GAAK;IACjD,OAAO,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC;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A,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","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\tshortFlag: 't',\n\t\t\t\t\tdescription: 'Run test files that match the provided pattern',\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\t// console.log([cmd, ...args].join(' '))\n\n\tconst child = execa(cmd, args, {\n\t\treject: false,\n\t\tbuffer: false,\n\t\t// encoding: null,\n\t\tshell: true,\n\t\tstdio: 'inherit',\n\t\tenv: { FORCE_COLOR: 'true' },\n\t});\n\n\treturn child.then(_ => {});\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\treturn opts.testPattern\n\t\t\t\t\t? execCmd('npx', ['jest', '-c', configAbsPath, '--testPathPattern', opts.testPattern])\n\t\t\t\t\t: execCmd('npx', ['jest', '-c', configAbsPath]);\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
CHANGED
package/package.json
CHANGED
package/proxy.ts
CHANGED
|
@@ -92,7 +92,18 @@ const ensurePartitionExists = (args: Opts) =>
|
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
const execCmd = (cmd: string, args: string[]) => {
|
|
95
|
-
|
|
95
|
+
// console.log([cmd, ...args].join(' '))
|
|
96
|
+
|
|
97
|
+
const child = execa(cmd, args, {
|
|
98
|
+
reject: false,
|
|
99
|
+
buffer: false,
|
|
100
|
+
// encoding: null,
|
|
101
|
+
shell: true,
|
|
102
|
+
stdio: 'inherit',
|
|
103
|
+
env: { FORCE_COLOR: 'true' },
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return child.then(_ => {});
|
|
96
107
|
};
|
|
97
108
|
|
|
98
109
|
export default async (args: RequestArgs.ProxyRequestArgs) => {
|
|
@@ -101,14 +112,9 @@ export default async (args: RequestArgs.ProxyRequestArgs) => {
|
|
|
101
112
|
return ensurePartitionExists(opts)
|
|
102
113
|
.then(configAbsPath => {
|
|
103
114
|
if (!opts.init) {
|
|
104
|
-
|
|
105
|
-
? execCmd('npx', ['jest', '-c', configAbsPath, '
|
|
115
|
+
return opts.testPattern
|
|
116
|
+
? execCmd('npx', ['jest', '-c', configAbsPath, '--testPathPattern', opts.testPattern])
|
|
106
117
|
: execCmd('npx', ['jest', '-c', configAbsPath]);
|
|
107
|
-
|
|
108
|
-
return cmd.then(({ stdout, stderr }) => {
|
|
109
|
-
if (stderr) sendErr(stderr);
|
|
110
|
-
return sendAsyncRes(stdout);
|
|
111
|
-
});
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
return sendAsyncRes('Initialized successfully.');
|