Conversation
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
|
@eladb snapshot tests will continue to fail due to generated date in the
Is it worth it to add a flag to |
eladb
left a comment
There was a problem hiding this comment.
Let's add a feature to snapshotDirectory that can filter out certain lines from the snapshotted files to address the timestamp issue:
await snapshotDirectory(target, {
excludeLines: [ /@javax.annotation.Generated/ ],
excludeFiles: [ /generated@0.0.0.jsii.tgz/ ]
});…ptions Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
| The output directory will include a java module that corresponds to the | ||
| original module. This code depends on the following maven package (should be defined directly or indirectly in the project's `pom.xml` file): | ||
|
|
||
| - [jsii](https://mvnrepository.com/artifact/software.amazon.jsii) |
There was a problem hiding this comment.
Also worth mentioning that the output will include a tarball resource that must be bundled in the project (maybe provide an example snippet from a pom.xml?)
|
|
||
| /** | ||
| * Produce java code. | ||
| * @default - java is not generated |
There was a problem hiding this comment.
Add a note here that says that the code will be produced under src (with an example of the full path combined with the package name). Also mention the requirements from Pom.xml (dependency on jsii runtime and resource).
|
|
||
| if (options.java) { | ||
| const reldir = options.java.package.replace(/\./g, '/'); | ||
| const source = path.resolve(path.join(workdir, 'dist/java/src/main/java', reldir)); |
There was a problem hiding this comment.
Why is it src/main? Is this where things are expected conventionally by the Pom.xml?
| import * as fs from 'fs-extra'; | ||
| import * as path from 'path'; | ||
|
|
||
| interface excludeOptions { |
There was a problem hiding this comment.
| interface excludeOptions { | |
| interface SnapshotOptions { |
| * file contents. Useful to perform snapshot testing against full directories. | ||
| */ | ||
| export async function snapshotDirectory(basedir: string, exclude: string[] = [], reldir = '.'): Promise<Record<string, string>> { | ||
| export async function snapshotDirectory(basedir: string, excludeOptions: excludeOptions = {}, reldir = '.'): Promise<Record<string, string>> { |
There was a problem hiding this comment.
| export async function snapshotDirectory(basedir: string, excludeOptions: excludeOptions = {}, reldir = '.'): Promise<Record<string, string>> { | |
| export async function snapshotDirectory(basedir: string, options: SnapshotOptions = {}, reldir = '.'): Promise<Record<string, string>> { |
Signed-off-by: campionfellin <campionfellin@gmail.com>
Issue #, if available:
#1
Description of changes:
TODO: the java that's output into the snapshots looks good to me, but I want to
yarn linkand test withcdk8sfirst.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.