mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
Add eslint and prettier support
This commit is contained in:
parent
95d413a2ce
commit
89f37d738b
20 changed files with 1971 additions and 170 deletions
|
|
@ -1,3 +1,2 @@
|
|||
|
||||
export { myFunction } from "./myFunction";
|
||||
export { myObject } from "./myObject";
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
|
||||
export const myFunction = ()=> Promise.resolve(["a", "b", "c"]);
|
||||
export function myFunction() {
|
||||
return Promise.resolve(["a", "b", "c"]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import { toUpperCase } from "./tools/toUpperCase";
|
||||
|
||||
export const myObject= { "p": toUpperCase("foo") };
|
||||
export const myObject = { "p": toUpperCase("foo") };
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getProjectRoot } from "../tools/getProjectRoot";
|
||||
|
||||
|
||||
import { getProjectRoot} from "../tools/getProjectRoot";
|
||||
|
||||
console.log(`Project root path: ${getProjectRoot()} does it seems right ? If yes then PASS`);
|
||||
console.log(
|
||||
`Project root path: ${getProjectRoot()} does it seems right ? If yes then PASS`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,40 +1,33 @@
|
|||
|
||||
//This will not run on deno, we need a separate index to run our tests.
|
||||
//This will not run on deno, we need a separate test runner for Deno (./mod.ts).
|
||||
|
||||
import * as child_process from "child_process";
|
||||
import * as path from "path";
|
||||
import { Deferred } from "evt/tools/Deferred";
|
||||
|
||||
const names = ["myFunction", "myObject", "getProjectRoot"];
|
||||
|
||||
(async () => {
|
||||
|
||||
if (!!process.env.FORK) {
|
||||
|
||||
process.once("unhandledRejection", error => { throw error; });
|
||||
process.once("unhandledRejection", error => {
|
||||
throw error;
|
||||
});
|
||||
|
||||
require(process.env.FORK);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (const name of [
|
||||
"myFunction",
|
||||
"myObject",
|
||||
"getProjectRoot"
|
||||
]) {
|
||||
|
||||
for (const name of names) {
|
||||
console.log(`Running: ${name}`);
|
||||
|
||||
const dExitCode = new Deferred<number>();
|
||||
|
||||
child_process.fork(
|
||||
__filename,
|
||||
undefined,
|
||||
{ "env": { "FORK": path.join(__dirname, name) } }
|
||||
)
|
||||
child_process
|
||||
.fork(__filename, undefined, {
|
||||
"env": { "FORK": path.join(__dirname, name) },
|
||||
})
|
||||
.on("message", console.log)
|
||||
.once("exit", code => dExitCode.resolve(code ?? 1))
|
||||
;
|
||||
.once("exit", code => dExitCode.resolve(code ?? 1));
|
||||
|
||||
const exitCode = await dExitCode.pr;
|
||||
|
||||
|
|
@ -44,7 +37,5 @@ import { Deferred } from "evt/tools/Deferred";
|
|||
}
|
||||
|
||||
console.log("\n");
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
|
||||
import { myFunction } from "..";
|
||||
|
||||
import { getPromiseAssertionApi } from "evt/tools/testing";
|
||||
|
||||
const { mustResolve } = getPromiseAssertionApi({ "takeIntoAccountArraysOrdering": true});
|
||||
const { mustResolve } = getPromiseAssertionApi({
|
||||
"takeIntoAccountArraysOrdering": true,
|
||||
});
|
||||
|
||||
(async () => {
|
||||
|
||||
await mustResolve({
|
||||
"promise": myFunction(),
|
||||
"expectedData": ["a", "b", "c"],
|
||||
"delay": 0
|
||||
"delay": 0,
|
||||
});
|
||||
|
||||
console.log("PASS");
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
|
||||
|
||||
import { assert } from "evt/tools/typeSafety";
|
||||
import * as inDepth from "evt/tools/inDepth";
|
||||
import { myObject } from "..";
|
||||
|
||||
assert(
|
||||
inDepth.same(
|
||||
myObject,
|
||||
{ "p": "FOO" }
|
||||
)
|
||||
);
|
||||
assert(inDepth.same(myObject, { "p": "FOO" }));
|
||||
|
||||
console.log("PASS");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
|
|
@ -6,17 +5,15 @@ function getProjectRootRec(dirPath: string): string {
|
|||
if (fs.existsSync(path.join(dirPath, "package.json"))) {
|
||||
return dirPath;
|
||||
}
|
||||
return getProjectRootRec(path.join(dirPath, ".."))
|
||||
return getProjectRootRec(path.join(dirPath, ".."));
|
||||
}
|
||||
|
||||
let result: string | undefined = undefined;
|
||||
|
||||
export function getProjectRoot(): string {
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return result = getProjectRootRec(__dirname);
|
||||
|
||||
return (result = getProjectRootRec(__dirname));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export function toUpperCase(str: string): string{
|
||||
export function toUpperCase(str: string): string {
|
||||
return str.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue