You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using yarn run untp test does not use the config file generated in step 2, which was a bit confusing. And these passed, but with no credentials to test. It's unclear what that means.
root@CAVICSR2D07CY3:/mnt/c/Users/177293/Documents/src/DITP/tests-untp/packages/untp-test-suite# yarn run test untp
yarn run v1.22.21
$ jest untp
PASS __tests__/interfaces/utils/common.test.ts (53.439 s)
PASS __tests__/core/services/dynamic-loading-schemas/loadingSchema.service.test.ts (62.958 s)
PASS __tests__/templates/utils.test.ts (68.464 s)
PASS __tests__/core/services/dynamic-loading-schemas/utils.test.ts (67.363 s)
PASS __tests__/interfaces/cli/testResultProcessor.test.ts (67.886 s)
PASS __tests__/interfaces/lib/testSuiteHandler.test.ts (74.511 s)
PASS __tests__/templates/mapper.test.ts (84.487 s)
PASS __tests__/core/services/json-schema/validator.service.test.ts (89.219 s)
PASS __tests__/interfaces/utils/credentials.test.ts (90.94 s)
PASS __tests__/core/utils/common.test.ts (98.198 s)
PASS __tests__/core/processTestSuite.test.ts (124.415 s)
Test Suites: 11 passed, 11 total
Tests: 64 passed, 64 total
Snapshots: 0 total
Time: 138.842 s, estimated 164 s
Ran all test suites matching /untp/i.
Done in 292.72s.
Step 3 - Part 2:
Running yarn run test untp --config ./credentials.json with the default configuration file gives the following warnings, but also runs the test suite, even with no files referenced in the datapaths.
root@CAVICSR2D07CY3:/mnt/c/Users/177293/Documents/src/DITP/tests-untp/packages/untp-test-suite# yarn run test untp --config ./credentials.json
yarn run v1.22.21
$ jest untp --config ./credentials.json
● Validation Warning:
Unknown option "credentials" with value [{"dataPath": "", "type": "aggregationEvent", "version": "v0.0.1"}, {"dataPath": "credentials/dev-mines-act-permit.json", "type": "conformityCredential", "version": "v0.0.1"}, {"dataPath": "", "type": "objectEvent", "version": "v0.0.1"}, {"dataPath": "", "type": "productPassport", "version": "v0.0.1"}, {"dataPath": "", "type": "transactionEvent", "version": "v0.0.1"}, {"dataPath": "", "type": "transformationEvent", "version": "v0.0.1"}] was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
● Validation Warning:
Unknown option "credentials" with value [{"dataPath": "", "type": "aggregationEvent", "version": "v0.0.1"}, {"dataPath": "credentials/dev-mines-act-permit.json", "type": "conformityCredential", "version": "v0.0.1"}, {"dataPath": "", "type": "objectEvent", "version": "v0.0.1"}, {"dataPath": "", "type": "productPassport", "version": "v0.0.1"}, {"dataPath": "", "type": "transactionEvent", "version": "v0.0.1"}, {"dataPath": "", "type": "transformationEvent", "version": "v0.0.1"}] was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
FAIL __tests__/core/services/dynamic-loading-schemas/utils.test.ts
● Test suite failed to run
Cannot find module '../../../utils/path.js' from 'src/core/services/dynamic-loading-schemas/utils.ts'
Require stack:
src/core/services/dynamic-loading-schemas/utils.ts
__tests__/core/services/dynamic-loading-schemas/utils.test.ts
1 | import fs from 'fs';
2 | import path from 'path';
> 3 | import { getCurrentDirPath, getCurrentFilePath } from '../../../utils/path.js';
| ^
4 |
5 | const currentDirPath = getCurrentDirPath(getCurrentFilePath());
6 | const SCHEMA_PATH = path.resolve(currentDirPath, '../../src/schemas');
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/core/services/dynamic-loading-schemas/utils.ts:3:1)
at Object.require (__tests__/core/services/dynamic-loading-schemas/utils.test.ts:4:1)
FAIL __tests__/core/processTestSuite.test.ts
● Test suite failed to run
Cannot find module './utils/common.js' from 'src/core/processTestSuite.ts'
Require stack:
src/core/processTestSuite.ts
__tests__/core/processTestSuite.test.ts
6 | ITestSuiteResult,
7 | } from './types/index.js';
> 8 | import { readJsonFile, validateCredentialConfigs } from './utils/common.js';
| ^
9 | import { dynamicLoadingSchemaService } from './services/dynamic-loading-schemas/loadingSchema.service.js';
10 | import { hasErrors } from './services/json-schema/validator.service.js';
11 | import {
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/core/processTestSuite.ts:8:1)
at Object.require (__tests__/core/processTestSuite.test.ts:2:1)
PASS integration/cli/cli.integration.test.ts (57.785 s)
PASS integration/cli/untpConfig.integration.test.ts (57.802 s)
FAIL src/interfaces/cli/test.ts
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/mnt/c/Users/177293/Documents/src/DITP/tests-untp/packages/untp-test-suite/node_modules/chalk/source/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import ansiStyles from '#ansi-styles';
^^^^^^
SyntaxError: Cannot use import statement outside a module
1 | import { Command } from 'commander';
> 2 | import chalk from 'chalk';
| ^
3 | import path from 'path';
4 | import { processTestSuiteForConfigPath } from '../../core/index.js';
5 | import { getFinalReport, getLogStatus } from './testResultProcessor.js';
at Runtime.createScriptFromCode (../../node_modules/jest-config/node_modules/jest-runtime/build/index.js:1505:14)
at Object.require (src/interfaces/cli/test.ts:2:1)
PASS __tests__/core/services/json-schema/validator.service.test.ts (69.033 s)
FAIL __tests__/interfaces/lib/testSuiteHandler.test.ts
● Test suite failed to run
Cannot find module './utils/common.js' from 'src/core/processTestSuite.ts'
Require stack:
src/core/processTestSuite.ts
__tests__/interfaces/lib/testSuiteHandler.test.ts
6 | ITestSuiteResult,
7 | } from './types/index.js';
> 8 | import { readJsonFile, validateCredentialConfigs } from './utils/common.js';
| ^
9 | import { dynamicLoadingSchemaService } from './services/dynamic-loading-schemas/loadingSchema.service.js';
10 | import { hasErrors } from './services/json-schema/validator.service.js';
11 | import {
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/core/processTestSuite.ts:8:1)
at Object.require (__tests__/interfaces/lib/testSuiteHandler.test.ts:1:1)
FAIL __tests__/interfaces/utils/credentials.test.ts
● Test suite failed to run
Cannot find module '../../utils/path.js' from 'src/interfaces/utils/credentials.ts'
Require stack:
src/interfaces/utils/credentials.ts
__tests__/interfaces/utils/credentials.test.ts
2 | import path from 'path';
3 | import semver from 'semver';
> 4 | import { getCurrentDirPath, getCurrentFilePath } from '../../utils/path.js';
| ^
5 |
6 | export interface ICredentialFileData {
7 | credentials: {
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/interfaces/utils/credentials.ts:4:1)
at Object.require (__tests__/interfaces/utils/credentials.test.ts:3:1)
FAIL __tests__/core/services/dynamic-loading-schemas/loadingSchema.service.test.ts
● Test suite failed to run
Cannot find module './utils.js' from 'src/core/services/dynamic-loading-schemas/loadingSchema.service.ts'
Require stack:
src/core/services/dynamic-loading-schemas/loadingSchema.service.ts
__tests__/core/services/dynamic-loading-schemas/loadingSchema.service.test.ts
1 | import { IDynamicLoadingSchemaService } from './types.js';
> 2 | import { checkSchemaExists, checkSchemaVersionExists, getSchemaContent } from './utils.js';
| ^
3 |
4 | export const dynamicLoadingSchemaService: IDynamicLoadingSchemaService = async (schema, version) => {
5 | const isValidSchema = await checkSchemaExists(schema);
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/core/services/dynamic-loading-schemas/loadingSchema.service.ts:2:1)
at Object.require (__tests__/core/services/dynamic-loading-schemas/loadingSchema.service.test.ts:1:1)
PASS __tests__/core/utils/common.test.ts (74.2 s)
PASS __tests__/interfaces/utils/common.test.ts (83.207 s)
FAIL __tests__/templates/mapper.test.ts
● Test suite failed to run
Cannot find module '../utils/path.js' from 'src/templates/mapper.ts'
Require stack:
src/templates/mapper.ts
__tests__/templates/mapper.test.ts
4 | import _ from 'lodash';
5 | import { IFinalReport, IValidatedCredentials } from '../core/types/index.js';
> 6 | import { getCurrentDirPath, getCurrentFilePath } from '../utils/path.js';
| ^
7 |
8 | Handlebars.registerHelper('jsonStringify', (jsonObject: object) => {
9 | if (!_.isObject(jsonObject) || _.isEmpty(jsonObject)) {
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/templates/mapper.ts:6:1)
at Object.require (__tests__/templates/mapper.test.ts:2:1)
FAIL build/interfaces/cli/test.js
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/mnt/c/Users/177293/Documents/src/DITP/tests-untp/packages/untp-test-suite/node_modules/chalk/source/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import ansiStyles from '#ansi-styles';
^^^^^^
SyntaxError: Cannot use import statement outside a module
1 | import { Command } from 'commander';
> 2 | import chalk from 'chalk';
| ^
3 | import path from 'path';
4 | import { processTestSuiteForConfigPath } from '../../core/index.js';
5 | import { getFinalReport, getLogStatus } from './testResultProcessor.js';
at Runtime.createScriptFromCode (../../node_modules/jest-config/node_modules/jest-runtime/build/index.js:1505:14)
at Object.require (src/interfaces/cli/test.ts:2:1)
FAIL __tests__/interfaces/cli/testResultProcessor.test.ts
● Test suite failed to run
Cannot find module '../../utils/common.js' from 'src/interfaces/cli/testResultProcessor.ts'
Require stack:
src/interfaces/cli/testResultProcessor.ts
__tests__/interfaces/cli/testResultProcessor.test.ts
1 | import chalk from 'chalk';
2 | import Table from 'cli-table3';
> 3 | import { getPackageVersion } from '../../utils/common.js';
| ^
4 | import {
5 | ICredentialTestResult,
6 | IError,
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/interfaces/cli/testResultProcessor.ts:3:1)
at Object.require (__tests__/interfaces/cli/testResultProcessor.test.ts:2:1)
FAIL __tests__/templates/utils.test.ts
● Test suite failed to run
Cannot find module '../utils/path.js' from 'src/templates/mapper.ts'
Require stack:
src/templates/mapper.ts
__tests__/templates/utils.test.ts
4 | import _ from 'lodash';
5 | import { IFinalReport, IValidatedCredentials } from '../core/types/index.js';
> 6 | import { getCurrentDirPath, getCurrentFilePath } from '../utils/path.js';
| ^
7 |
8 | Handlebars.registerHelper('jsonStringify', (jsonObject: object) => {
9 | if (!_.isObject(jsonObject) || _.isEmpty(jsonObject)) {
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/templates/mapper.ts:6:1)
at Object.require (__tests__/templates/utils.test.ts:2:1)
FAIL integration/lib/lib.integration.test.ts
● Test suite failed to run
Cannot find module '../../core/processTestSuite.js' from 'src/interfaces/lib/testSuiteHandler.ts'
Require stack:
src/interfaces/lib/testSuiteHandler.ts
integration/lib/lib.integration.test.ts
1 | import { TestCredentialHandler, TestCredentialsHandler } from './types.js';
2 | import { ICredentialConfigs } from '../../core/types/index.js';
> 3 | import {
| ^
4 | processTestSuite,
5 | processTestSuiteForConfigPath,
6 | processTestSuiteForCredential,
at Resolver._throwModNotFoundError (../../node_modules/jest-config/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.require (src/interfaces/lib/testSuiteHandler.ts:3:1)
at Object.require (integration/lib/lib.integration.test.ts:3:1)
FAIL integration/cli/untpTest.integration.test.ts (152.564 s)
● CLI 'untp test' Commands › Validation of `schema` in the configuration file › should ensure that the schema file of each credential exists
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
16 |
17 | const mockPath = `${process.cwd()}/integration/mock/untpTestPass`;
> 18 | beforeAll((done) => {
| ^
19 | credentialFileName = 'credentialsExample.json';
20 | storePath = `${mockPath}/${credentialFileName}`;
21 | const fileContent = fs.readFileSync(storePath, 'utf8');
at beforeAll (integration/cli/untpTest.integration.test.ts:18:5)
at describe (integration/cli/untpTest.integration.test.ts:11:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
● CLI 'untp test' Commands › Validation of `schema` in the configuration file › should return the content of `schema` when file is valid
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
16 |
17 | const mockPath = `${process.cwd()}/integration/mock/untpTestPass`;
> 18 | beforeAll((done) => {
| ^
19 | credentialFileName = 'credentialsExample.json';
20 | storePath = `${mockPath}/${credentialFileName}`;
21 | const fileContent = fs.readFileSync(storePath, 'utf8');
at beforeAll (integration/cli/untpTest.integration.test.ts:18:5)
at describe (integration/cli/untpTest.integration.test.ts:11:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
● CLI 'untp test' Commands › process test runner and final report return PASS › should show PASS in report when all data validate
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
66 |
67 | const mockPath = `${process.cwd()}/integration/mock/untpTestPass`;
> 68 | beforeAll((done) => {
| ^
69 | credentialFileName = 'credentialsExample.json';
70 | storePath = `${mockPath}/${credentialFileName}`;
71 |
at beforeAll (integration/cli/untpTest.integration.test.ts:68:5)
at describe (integration/cli/untpTest.integration.test.ts:62:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
● CLI 'untp test' Commands › process test runner and final report return FAIL › should show FAIL in the report when data invalidate
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
93 |
94 | const mockPath = `${process.cwd()}/integration/mock/untpTestFail`;
> 95 | beforeAll((done) => {
| ^
96 | credentialFileName = 'credentialsExample.json';
97 | storePath = `${mockPath}/${credentialFileName}`;
98 |
at beforeAll (integration/cli/untpTest.integration.test.ts:95:5)
at describe (integration/cli/untpTest.integration.test.ts:89:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
● CLI 'untp test' Commands › process test runner and final report return WARN › should show WARN in the report when data invalidate
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
124 |
125 | const mockPath = `${process.cwd()}/integration/mock/untpTestWarn`;
> 126 | beforeAll((done) => {
| ^
127 | credentialFileName = 'credentialsExample.json';
128 | storePath = `${mockPath}/${credentialFileName}`;
129 |
at beforeAll (integration/cli/untpTest.integration.test.ts:126:5)
at describe (integration/cli/untpTest.integration.test.ts:120:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
● CLI 'untp test' Commands › process test runner with result combine FAIL and WARN and final report return FAIL › should show WARN in the report when data invalidate
thrown: "Exceeded timeout of 5000 ms for a hook while waiting for `done()` to be called.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
151 |
152 | const mockPath = `${process.cwd()}/integration/mock/untpTestFailuresAndWarnings`;
> 153 | beforeAll((done) => {
| ^
154 | credentialFileName = 'credentialsExample.json';
155 | storePath = `${mockPath}/${credentialFileName}`;
156 |
at beforeAll (integration/cli/untpTest.integration.test.ts:153:5)
at describe (integration/cli/untpTest.integration.test.ts:147:3)
at Object.describe (integration/cli/untpTest.integration.test.ts:6:1)
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Test Suites: 12 failed, 5 passed, 17 total
Tests: 6 failed, 15 passed, 21 total
Snapshots: 0 total
Time: 166.013 s, estimated 193 s
Ran all test suites matching /untp/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step 3 - Part 3:
Updating the config credentials.json file to reference the credential I want to test like so.
Logically, is there going to be a way to test a single credential against the spec in a meaningful way, or will the tester always need to produce a suite of credentials to test their relationships (passport, events, conformity credentials ) etc.? We are producing a Digital Conformity Credential for others to reference in digital produce passports, so it would be nice if the testing did not require us to produce 'mock' digital product passports when we do not know what they might contain or how they will be used.
Is there a suite of credentials that have passed the test suite? I have not found them in the repo or the steps, but this would also be a valuable addition to the usability of this test suite to have a valid a example.
The text was updated successfully, but these errors were encountered:
I think i have produced a valid conformity credential, but I want to make sure it conformant to the spec using this tool.
Following these steps https://uncefact.github.io/tests-untp/docs/test-suites/semantic-interoperability/cli/installation
Step 1
Went smoothly, even if a bit slow (on WSL).
Step 2
Worked to generate the config file.
Step 3 - Part 1:
Using
yarn run untp test
does not use the config file generated in step 2, which was a bit confusing. And these passed, but with no credentials to test. It's unclear what that means.Step 3 - Part 2:
Running
yarn run test untp --config ./credentials.json
with the default configuration file gives the following warnings, but also runs the test suite, even with no files referenced in the datapaths.Step 3 - Part 3:
Updating the config credentials.json file to reference the credential I want to test like so.
I get a similar errored output to part 2, but again, am not sure if this a valid input to the test suite.
Here is the credential I want to test at
dev-mines-act-permit.json
, which certainly may not be valid, that's what i'd like to validate.Questions
The text was updated successfully, but these errors were encountered: