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

Commit

Permalink
Merge pull request #6118 from trufflesuite/fix-test
Browse files Browse the repository at this point in the history
handle case when a user uses @truffle/test without core
  • Loading branch information
eggplantzzz authored Jun 23, 2023
2 parents 4308cde + 3eba98a commit 6b22766
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 6b22766

Please sign in to comment.