Skip to content

Commit

Permalink
feat: Include __mocks__ in TS output (and published library)
Browse files Browse the repository at this point in the history
In #223 (and #233) we started adding a tag (`gu:cdk:version`) to track which version of `@guardian/cdk` is being used.

This tag helps us measure adoption:
  - the presence of the tag tells us the library is being used
  - the value of the tag tells us the version of the library being used

Whilst this is really useful, it does somewhat block users from using tools such as dependabot.
This is because the snapshot tests will _always_ fail due to the value of the tag changing between version numbers.

In this repository, we have configured a global mock for this tag to ensure its value is static, thus simplifying the tests.

This change updates the TypeScript configuration to include (more specifically stop excluding) the `__mocks__` directories.

This results in all mocks making their way into the published library which can then be used within client stacks,
to also have a static value.

We currently have a single mock in the repository. If we add more, we may want to be more selective about which of them get published.
  • Loading branch information
akash1810 committed Apr 15, 2021
1 parent b5687ef commit 17f16b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"outDir": "lib"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/__snapshots__/**", "src/**/__mocks__/**"]
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/__snapshots__/**"]
}

0 comments on commit 17f16b1

Please sign in to comment.