put-filepath-as-comment
v1.0.9
Published
[](https://dl.circleci.com/status-badge/redirect/gh/HiromiShikata/put-filepath-as-comment/tree/main) [ => {
it('should output file contents', () => {
rmdirSync('./tmp/testdata', { recursive: true });
mkdirSync('./tmp/testdata/src/domain/entities', { recursive: true });
writeFileSync(
'./tmp/testdata/src/domain/entities/Group.ts',
`export class Group {
id: string
name: string
}`,
);
const expectedContent = `// tmp/testdata/src/domain/entities/Group.ts
export class Group {
id: string
name: string
}`;
execSync(
'npx ts-node ./src/adapter/entry-points/cli/index.ts ./tmp/testdata/src',
);
const contents = readFileSync(
'./tmp/testdata/src/domain/entities/Group.ts',
'utf-8',
);
expect(contents).toBe(expectedContent);
execSync(
'npx ts-node ./src/adapter/entry-points/cli/index.ts ./tmp/testdata/src',
);
const contentsSecondTime = readFileSync(
'./tmp/testdata/src/domain/entities/Group.ts',
'utf-8',
);
expect(contentsSecondTime).toBe(expectedContent);
});
});This example demonstrates how put-filepath-as-comment can be used to add a file path comment to the file.
Contributing
Contributions are welcome! Please read the CONTRIBUTING.md file for guidelines on how to contribute to this project.
License
This project is licensed under the MIT License. See the LICENSE file for details.
