kryptheon 0.1.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/README.md +86 -0
- package/bin/kryptheon.js +554 -0
- package/kryptheon-fixture.js +324 -0
- package/kryptheon-reporter.js +678 -0
- package/package.json +38 -0
- package/playwright.config.js +60 -0
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kryptheon",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Record what you do in your app and get plain-language reports when it breaks.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"kryptheon": "bin/kryptheon.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./kryptheon-fixture.js",
|
|
12
|
+
"./kryptheon-fixture": "./kryptheon-fixture.js",
|
|
13
|
+
"./kryptheon-reporter": "./kryptheon-reporter.js",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/",
|
|
18
|
+
"kryptheon-fixture.js",
|
|
19
|
+
"kryptheon-reporter.js",
|
|
20
|
+
"playwright.config.js",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20.6.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@playwright/test": "^1.62.1"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"check": "node kryptheon-reporter.check.js"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"playwright",
|
|
34
|
+
"testing",
|
|
35
|
+
"end-to-end",
|
|
36
|
+
"cli"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { defineConfig } = require('@playwright/test');
|
|
4
|
+
|
|
5
|
+
// Tool files come from the installed package; anything belonging to the person
|
|
6
|
+
// running the command comes from the folder they ran it in.
|
|
7
|
+
const PACKAGE_DIR = __dirname;
|
|
8
|
+
const USER_DIR = process.cwd();
|
|
9
|
+
|
|
10
|
+
// Node's built-in .env loader (no dependency). This file is re-evaluated in
|
|
11
|
+
// each worker process, so the values reach the tests themselves. A missing
|
|
12
|
+
// .env is not fatal: CI can supply the same variables as real env vars.
|
|
13
|
+
// loadEnvFile only exists from Node 20.12, and the package supports 20.6, so
|
|
14
|
+
// fall back to a small parser rather than silently skipping the file.
|
|
15
|
+
function loadEnv(file) {
|
|
16
|
+
if (typeof process.loadEnvFile === 'function') {
|
|
17
|
+
try {
|
|
18
|
+
process.loadEnvFile(file);
|
|
19
|
+
return;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
if (err && err.code !== 'ENOENT') throw err;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let raw;
|
|
26
|
+
try {
|
|
27
|
+
raw = require('fs').readFileSync(file, 'utf8');
|
|
28
|
+
} catch (err) {
|
|
29
|
+
return; // no .env is fine
|
|
30
|
+
}
|
|
31
|
+
for (const line of raw.split('\n')) {
|
|
32
|
+
const match = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/);
|
|
33
|
+
if (!match) continue;
|
|
34
|
+
const value = match[2].replace(/^(['"])(.*)\1$/, '$2');
|
|
35
|
+
if (process.env[match[1]] === undefined) process.env[match[1]] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
loadEnv(path.join(USER_DIR, '.env'));
|
|
40
|
+
|
|
41
|
+
module.exports = defineConfig({
|
|
42
|
+
// The tests belong to the user, so they are found in their folder.
|
|
43
|
+
testDir: path.join(USER_DIR, 'tests'),
|
|
44
|
+
// Screenshots and other artefacts default to sitting next to the config,
|
|
45
|
+
// which once installed means inside node_modules. Keep them with the user.
|
|
46
|
+
outputDir: path.join(USER_DIR, 'test-results'),
|
|
47
|
+
// These tests all run against one live site, so in parallel they interfere
|
|
48
|
+
// with each other - a shared logged-in session, and rate limiting on the
|
|
49
|
+
// real endpoints. Serial is the safe default here.
|
|
50
|
+
fullyParallel: false,
|
|
51
|
+
workers: 1,
|
|
52
|
+
// Only the plain-language reporter: Playwright's 'list' reporter prints its
|
|
53
|
+
// own stack-trace block on failure, which is what we are hiding here.
|
|
54
|
+
// Resolved from the package so it is found wherever the command is run.
|
|
55
|
+
reporter: [[path.join(PACKAGE_DIR, 'kryptheon-reporter.js')]],
|
|
56
|
+
use: {
|
|
57
|
+
headless: true,
|
|
58
|
+
screenshot: 'only-on-failure',
|
|
59
|
+
},
|
|
60
|
+
});
|