Make it so that we can console.log in browser to debug gentest (#1718)

Summary:

Our gentest works by console.logging the contents of the test it is generating to the browser powered by the driver. The driver then reads the logs and writes it to a file. An unfortunate side effect here is that we cannot console.log to debug how the gentest logic actually works since the driver is expecting formatted code. To get around this I had the driver filter out logs with a certain prefix and add that a helper that logs a message with this prefix to the scripts.

Reviewed By: NickGerleman

Differential Revision: D64011035
This commit is contained in:
Joe Vilches
2024-10-09 15:46:46 -07:00
committed by Facebook GitHub Bot
parent e69fcb26bb
commit e03737ab8c
3 changed files with 21 additions and 3 deletions

11
gentest/gentest-log.js Normal file
View File

@@ -0,0 +1,11 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// eslint-disable-next-line no-unused-vars
function gentestLog(message) {
console.log('gentest-log: ', message);
}