Skip to content

Commit

Permalink
don't warn for setup and teardown decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesadarich committed Oct 18, 2018
1 parent fb0de8c commit 1e47cd5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions core/decorators/create-setup-teardown-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "reflect-metadata";
import { ISetupTeardownMetadata } from "./_interfaces";
import { deprecate } from "../maintenance/deprecate";
import { SETUP_FIXTURE } from "./_metadata-keys";

export function createSetupTeardownDecorator(
metadataDescription: string,
Expand All @@ -20,11 +21,13 @@ export function createSetupTeardownDecorator(
.replace("setup", "Setup")
.replace("teardown", "Teardown");

deprecate(
isAsync ? `Async${functionName}` : functionName,
"4.0.0",
`Use the ${functionName.replace("Fixture", "")} decorator instead.`
);
if (metadataDescription.indexOf("-fixture") > -1 || isAsync) {
deprecate(
isAsync ? `Async${functionName}` : functionName,
"4.0.0",
`Use the ${functionName.replace("Fixture", "")} decorator instead.`
);
}

functions.push({
isAsync,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ TAP version 13
1..16
# FIXTURE asynchronous tests
# WARN: AsyncTest has been depreacated and will be removed in version 4.0.0. Use the Test decorator instead.
# WARN: SetupFixture has been depreacated and will be removed in version 4.0.0. Use the Setup decorator instead.
# WARN: AsyncSetup has been depreacated and will be removed in version 4.0.0. Use the Setup decorator instead.
# WARN: TeardownFixture has been depreacated and will be removed in version 4.0.0. Use the Teardown decorator instead.
# WARN: AsyncTeardown has been depreacated and will be removed in version 4.0.0. Use the Teardown decorator instead.
ok 1 simple passing asynchronous test
not ok 2 simple failing asynchronous test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TAP version 13
1..3
# FIXTURE setup tests
# WARN: SetupFixture has been depreacated and will be removed in version 4.0.0. Use the Setup decorator instead.
# WARN: AsyncSetup has been depreacated and will be removed in version 4.0.0. Use the Setup decorator instead.
ok 1 simple setup
ok 2 simple async setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TAP version 13
1..5
# FIXTURE teardown fixtures
# WARN: TeardownFixture has been depreacated and will be removed in version 4.0.0. Use the Teardown decorator instead.
# WARN: AsyncTeardown has been depreacated and will be removed in version 4.0.0. Use the Teardown decorator instead.
ok 1 teardown fixture not called before first test
ok 2 teardown fixture has still not been called after first test or before second
Expand Down

0 comments on commit 1e47cd5

Please sign in to comment.