Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

handle case when a user uses @truffle/test without core #6118

Merged
merged 1 commit into from
Jun 23, 2023
Merged
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
16 changes: 15 additions & 1 deletion packages/test/src/Test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface SetJSTestGlobalsInterface {
export const Test = {
run: async function (
options: Config,
createInTestDebugFunction: CreateInTestDebugFunction
createInTestDebugFunction?: CreateInTestDebugFunction
) {
expect.options(options, [
"contracts_directory",
Expand All @@ -56,6 +56,20 @@ export const Test = {
"provider"
]);

// if test is used standalone, this function won't be setup like in core
if (createInTestDebugFunction === undefined) {
createInTestDebugFunction = () => {
return () => {
config.logger.log(
`${colors.bold(
"Warning:"
)} Use of in-test debugging is only available when running ` +
`truffle test --debug.`
);
};
};
}

const config = Config.default().merge(options);

config.test_files = config.test_files.map((testFile: string) => {
Expand Down