TypeScript: solution failed online but passed locally.
See original GitHub issueBug, timeout or some kind of change? Time took to run : 16.309 s.
const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const random = (min: number, max: number /* max is exclusive */) =>
Math.floor(Math.random() * (max - min) + min);
export class Robot {
private static names = new Set();
private robotName: string = "";
constructor() {
this.robotName = Robot.generateName();
}
public get name(): string {
return this.robotName;
}
public resetName(): void {
this.robotName = Robot.generateName();
}
public static releaseNames(): void {
this.names.clear();
}
private static randomLetter(): string {
return LETTERS[random(0, 26)];
}
private static randomDigit(): number {
return random(0, 10);
}
private static generateName(): string {
let name;
do {
name = [
Robot.randomLetter(),
Robot.randomLetter(),
Robot.randomDigit(),
Robot.randomDigit(),
Robot.randomDigit(),
].join("");
} while (Robot.names.has(name));
Robot.names.add(name);
return name;
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
TypeScript: says passed tests but doesn't compile locally (and ...
This may be related, which is a solution which failed online but passed locally, including the optional test. I wonder if the commented...
Read more >My code failed in pipeline but passed in local, why ... - YouTube
My code failed in pipeline but passed in local, why? ... 540 views 1 month ago Playwright framework - Typescript.
Read more >Tests passing locally but failing with circleci Typescript issue
Hi guys, I have tests that are all passing locally, but when circleci runs the same tests they are failing. error: FAIL server/src/User-Server/test/routes.test....
Read more >[ESLint] Passes locally but fails in CI : r/typescript - Reddit
When I run eslint locally for a PR I'm working on, everything passes but when it runs in the CI environment, one of...
Read more >TypeScript errors and how to fix them
Common Errors Below you find a list of common TypeScript errors along with the buggy code and its fixed version.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Should have been solved! If not, please comment here again so we can re-open.
Yeah, I’m not against that @bobahop 😃