Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sm/test-naming #1122

Merged
merged 5 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
command: 'yarn test:nuts'
os: ${{ matrix.os }}
useCache: false
# remove the test folder for sfdx-core
preBuildCommands: 'shx rm -rf test'
preSwapCommands: 'yarn upgrade @jsforce/jsforce-node@latest; npx yarn-deduplicate; yarn install'
preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/core/node_modules/@jsforce/jsforce-node shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core node_modules/@salesforce/cli-plugins-testkit/node_modules/@salesforce/core node_modules/@salesforce/source-tracking/node_modules/@salesforce/core node_modules/@salesforce/source-deploy-retrieve/node_modules/@salesforce/core node_modules/@salesforce/apex-node/node_modules/@salesforce/core'
secrets: inherit
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": "test/init.js, ts-node/register, source-map-support/register",
"require": "ts-node/register, source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"recursive": true,
Expand Down
2 changes: 1 addition & 1 deletion .sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"test": {
"testsPath": "test/**/*Test.ts"
"testsPath": "test/unit/**/*.test.ts"
},
"wireit": {
"compile": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"output": []
},
"test:only": {
"command": "nyc mocha \"test/**/*Test.ts\"",
"command": "nyc mocha \"test/unit/**/*.test.ts\"",
"env": {
"FORCE_COLOR": "2"
},
Expand Down Expand Up @@ -182,4 +182,4 @@
"command": "tsc -p typedocExamples"
}
}
}
}
8 changes: 0 additions & 8 deletions test/init.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@salesforce/dev-config/tsconfig-test-strict",
"include": ["nut/**/*.ts", "unit/**/*.ts", "perf/**/*.ts", "nut/configFileConcurrency.nut.ts"],
"include": ["nut/**/*.ts", "unit/**/*.ts", "perf/**/*.ts"],
"compilerOptions": {
"noEmit": true,
"skipLibCheck": true,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('TTLConfig', () => {
it('should return the latest entry', async () => {
const config = await TestConfig.create();
config.set('1', { one: 'one' });
await sleep(1000);
await sleep(200);
config.set('2', { two: 'two' });
const latest = config.getLatestEntry();
expect(latest).to.deep.equal(['2', config.get('2')]);
Expand All @@ -68,7 +68,7 @@ describe('TTLConfig', () => {
it('should return the key of the latest entry', async () => {
const config = await TestConfig.create();
config.set('1', { one: 'one' });
await sleep(1000);
await sleep(200);
config.set('2', { two: 'two' });
const latest = config.getLatestKey();
expect(latest).to.equal('2');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/unit/loggerTest.ts → test/unit/logger/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import { expect, config as chaiConfig } from 'chai';
import { isString } from '@salesforce/ts-types';
import { Logger, LoggerLevel, computeLevel } from '../../src/logger/logger';
import { shouldThrowSync, TestContext } from '../../src/testSetup';
import { Logger, LoggerLevel, computeLevel } from '../../../src/logger/logger';
import { shouldThrowSync, TestContext } from '../../../src/testSetup';

// NOTE: These tests still use 'await' which is how it use to work and were left to make
// sure we didn't regress the way they were used.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/unit/sfErrorTest.ts → test/unit/sfError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ describe('SfError', () => {
it('returned `name:message` when no cause', () => {
const err = new SfError('test');
expect(inspect(err)).to.include('SfError: test');
expect(inspect(err)).to.include('sfErrorTest.ts');
expect(inspect(err)).to.include('sfError.test.ts');
// there's always 1 cause from the `cause:` property, even if undefined
expect(inspect(err)?.match(causeRegex)).to.have.lengthOf(1);
});
it('1 cause', () => {
const nestedError = new Error('nested');
const err = new SfError('test', undefined, undefined, nestedError);
expect(inspect(err)).to.include('SfError: test');
expect(inspect(err)).to.include('sfErrorTest.ts');
expect(inspect(err)).to.include('sfError.test.ts');
expect(inspect(err)).to.include('nested');
expect(inspect(err)?.match(causeRegex)).to.have.lengthOf(1);
expect(inspect(err)?.match(nestedCauseRegex)).to.be.null;
Expand All @@ -97,7 +97,7 @@ describe('SfError', () => {
const nestedError2 = new Error('nested2', { cause: nestedError });
const err = new SfError('test', undefined, undefined, nestedError2);
expect(inspect(err)).to.include('SfError: test');
expect(inspect(err)).to.include('sfErrorTest.ts');
expect(inspect(err)).to.include('sfError.test.ts');
expect(inspect(err)).to.include('nested');
expect(inspect(err)).to.include('nested2');
expect(inspect(err)?.match(causeRegex)).to.have.lengthOf(1);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading