Skip to content

Commit 71f85e1

Browse files
authored
fix: CJS and ESM exports (#22)
1 parent bea50b5 commit 71f85e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+764
-313
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ module.exports = {
7777
"coverage",
7878
"dist",
7979
"e2e",
80+
"package-e2e",
8081
"website",
81-
"/*.js"
82+
"/*.js",
83+
"/*.mjs",
84+
"/*.d.ts"
8285
]
8386
};

api.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/api');

api.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/api.js';

e2e/configs/default.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// eslint-disable-next-line node/no-extraneous-require,@typescript-eslint/no-var-requires,import/no-extraneous-dependencies
22
const _ = require('lodash');
3-
const { Status } = require('jest-allure2-reporter');
43
const PRESET = process.env.ALLURE_PRESET ?? 'default';
54

65
/** @type {import('jest-allure2-reporter').ReporterOptions} */
@@ -9,12 +8,12 @@ const jestAllure2ReporterOptions = {
98
categories: [
109
{
1110
name: 'Snapshot mismatches',
12-
matchedStatuses: [Status.FAILED],
11+
matchedStatuses: ['failed'],
1312
messageRegex: /.*\btoMatch(?:[A-Za-z]+)?Snapshot\b.*/,
1413
},
1514
{
1615
name: 'Timeouts',
17-
matchedStatuses: [Status.BROKEN],
16+
matchedStatuses: ['broken'],
1817
messageRegex: /.*Exceeded timeout of.*/,
1918
},
2019
],

e2e/src/programmatic/grouping/client/auth/ForgotPasswordScreen.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { $Epic, $Feature, $Story, $Tag } from 'jest-allure2-reporter';
2-
31
$Tag('client');
42
$Epic('Authentication');
53
$Feature('Restore account');

e2e/src/programmatic/grouping/client/auth/LoginScreen.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $Epic, $Feature, $Story, $Tag } from 'jest-allure2-reporter';
21
import LoginHelper from '../../../../utils/LoginHelper';
32

43
/**

e2e/src/programmatic/grouping/client/utils/validators.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { $Tag } from 'jest-allure2-reporter';
2-
31
$Tag('client');
42
describe('Validators', () => {
53
describe('emailValidator', () => {

e2e/src/programmatic/grouping/server/controllers/forgotPassword.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { $Epic, $Feature, $Story, $Tag } from 'jest-allure2-reporter';
2-
31
$Tag('server');
42
$Epic('Authentication');
53
$Feature('Restore account');

e2e/src/programmatic/grouping/server/controllers/login.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { $Epic, $Feature, $Story, $Tag } from 'jest-allure2-reporter';
2-
31
$Tag('server');
42
$Epic('Authentication');
53
$Feature('Login');

e2e/src/programmatic/grouping/server/controllers/resetPassword.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { $Epic, $Feature, $Story, $Tag } from 'jest-allure2-reporter';
2-
31
$Tag('server');
42
$Epic('Authentication');
53
$Feature('Restore account');

e2e/src/utils/LoginHelper.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Attachment, FileAttachment, Step} from 'jest-allure2-reporter';
2-
31
class LoginHelper {
42
#email?: string;
53
#password?: string;

e2e/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"module": "node16",
55
"ignoreDeprecations": "5.0",
66
"experimentalDecorators": true,
7-
"noEmit": true
7+
"noEmit": true,
8+
"types": ["node", "jest", "jest-allure2-reporter/globals"]
89
}
910
}

environment-jsdom.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
// Fallback for Jest 27.x.x
2-
module.exports = require('./dist/environment/jsdom');
1+
module.exports = require('./dist/environment/jsdom').default;

environment-jsdom.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import jsdom from './dist/environment/jsdom.js';
2+
3+
const { default: TestEnvironment } = jsdom;
4+
5+
export default TestEnvironment;

environment-listener.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
// Fallback for Jest 27.x.x
2-
module.exports = require('./dist/environment/listener');
1+
module.exports = require('./dist/environment/listener').default;

environment-listener.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import environmentListener from './dist/environment/listener.js';
2+
3+
const { default: listener } = environmentListener;
4+
5+
export default listener;

environment-node.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
// Fallback for Jest 27.x.x
2-
module.exports = require('./dist/environment/node');
1+
module.exports = require('./dist/environment/node').default;

environment-node.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import node from './dist/environment/node.js';
2+
3+
const { default: TestEnvironment } = node;
4+
5+
export default TestEnvironment;

globals.d.ts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as api from './dist/api';
2+
3+
declare global {
4+
namespace NodeJS {
5+
interface Global {
6+
// Runtime API
7+
allure: typeof api.allure;
8+
// Pseudo-annotations
9+
$Description: typeof api.$Description;
10+
$DescriptionHtml: typeof api.$DescriptionHtml;
11+
$Epic: typeof api.$Epic;
12+
$Feature: typeof api.$Feature;
13+
$Issue: typeof api.$Issue;
14+
$Link: typeof api.$Link;
15+
$Owner: typeof api.$Owner;
16+
$Severity: typeof api.$Severity;
17+
$Story: typeof api.$Story;
18+
$Tag: typeof api.$Tag;
19+
$TmsLink: typeof api.$TmsLink;
20+
// Decorators
21+
Attachment: typeof api.Attachment;
22+
FileAttachment: typeof api.FileAttachment;
23+
Step: typeof api.Step;
24+
}
25+
}
26+
27+
// Runtime API
28+
var allure: typeof api.allure;
29+
// Pseudo-annotations
30+
var $Description: typeof api.$Description;
31+
var $DescriptionHtml: typeof api.$DescriptionHtml;
32+
var $Epic: typeof api.$Epic;
33+
var $Feature: typeof api.$Feature;
34+
var $Issue: typeof api.$Issue;
35+
var $Link: typeof api.$Link;
36+
var $Owner: typeof api.$Owner;
37+
var $Severity: typeof api.$Severity;
38+
var $Story: typeof api.$Story;
39+
var $Tag: typeof api.$Tag;
40+
var $TmsLink: typeof api.$TmsLink;
41+
// Decorators
42+
var Attachment: typeof api.Attachment;
43+
var FileAttachment: typeof api.FileAttachment;
44+
var Step: typeof api.Step;
45+
}

globals.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

globals.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

0 commit comments

Comments
 (0)